It looks like the current Ruby Mongo Driver 2.0.4 no longer has the find_one method. I can only find it in reference to GridFS.
How can I retrieve a single document from Mongo using the official ruby driver? The find method returns a collection not a single object.
find()
returns a CollectionView
which is a not-yet-executed query which behaves like an enumerable. To find just the first record:
find.limit(1).first
(Yes, it is annoying)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With