Module: Mongoid::Contexts::Ids
- Included in:
- MongoDoc::Contexts::Mongo, Enumerable
- Defined in:
- lib/mongo_doc/contexts/ids.rb
Instance Method Summary collapse
-
#id_criteria(params) ⇒ Object
Return documents based on an id search.
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.
14 15 16 17 |
# File 'lib/mongo_doc/contexts/ids.rb', line 14 def id_criteria(params) criteria.id(strings_to_object_ids(params)) params.is_a?(Array) ? criteria.entries : one end |