Class: Mongoid::Criteria

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/collection_separated/monkey_patches.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#ensured_collectionObject



122
123
124
# File 'lib/mongoid/collection_separated/monkey_patches.rb', line 122

def ensured_collection
  context.collection
end