Module: Mongoid::Contexts::Ids

Includes:
IdConversion
Included in:
MongoDoc::Contexts::Mongo, Enumerable
Defined in:
lib/mongo_doc/contexts/ids.rb

Instance Method Summary collapse

Instance Method Details

#id_criteria(params) ⇒ Object

Return documents based on an id search. Will handle if a single id has been passed or mulitple ids.

Example:

context.id_criteria([1, 2, 3])

Returns:

The single or multiple documents.



16
17
18
19
# File 'lib/mongo_doc/contexts/ids.rb', line 16

def id_criteria(params)
  criteria.id(strings_to_object_ids(params))
  params.is_a?(Array) ? criteria.entries : one
end