Method: XGen::Mongo::Driver::Collection#find_first
- Defined in:
- lib/mongo/collection.rb
#find_first(selector = {}, options = {}) ⇒ Object
Find the first record that matches selector. See #find.
69 70 71 72 73 74 |
# File 'lib/mongo/collection.rb', line 69 def find_first(selector={}, ={}) h = .dup h[:limit] = 1 cursor = find(selector, h) cursor.next_object # don't need to explicitly close b/c of limit end |