Origin
Origin provides a DSL to mix in to any object to give it the ability to build MongoDB queries easily. It was extracted from Mongoid in an attempt to allow others to leverage the DSL in their own applications without needing a mapper.
Sample Syntax
Origin only supports MRI 1.9.2, 1.9.3, and HEAD, Rubinius 2 in 1.9 mode, and JRuby 1.6.0+ in 1.9 mode. All code samples will use 1.9 syntax. |
class Criteria include Origin::Queryable end criteria = Criteria.new criteria = criteria.where(name: "Syd").gt(age: 10).desc(:created_at) criteria.selector #=> { name: "Syd", age: { "$gt" => 10 }} criteria.options #=> { sort: { created_at: -1 }}