Details
-
Improvement
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
-
Minor Change
Description
I found myself on the console today trying to debug an issue by looking at mongoid documents:
$ items.find { |item| item["uuid"] == "1234" } |
=> nil |
$ items.select { |item| item["uuid"] == "1234" }.any? |
=> true |
In this case, `items` is an instance of `Mongoid::Criteria`, and the `find` being executed was `Mongoid::Criteria::Findable#find`, rather than the `Enumerable#find` which I expected. (Items is defined in another method, in another file, elsewhere, so I had forgotten it was a `Mongoid::Criteria` rather than simply an Enumerable)
I propose that we add a `Mongoid::Criteria#find` which routes to the appropriate find method based on the passed arguments
Attachments
Issue Links
- is related to
-
MONGOID-5003 Delegate Model#find with block argument to Enumerable#find
-
- Closed
-
- links to