class Mongoid::Criteria

The Criteria class is the core object needed in Mongoid to retrieve objects from the database. It is a DSL that essentially sets up the selector and options arguments that get passed on to a Mongo::Collection in the Ruby driver. Each method on the Criteria returns self to they can be chained in order to create a readable criterion to be executed against the database.

Public Instance Methods

ensured_collection() click to toggle source
# File lib/mongoid/collection_separated/monkey_patches.rb, line 122
def ensured_collection
  context.collection
end