Created
September 14, 2010 22:21
-
-
Save erh/579892 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coll = db.foo | |
coll.drop() | |
coll.insert( { arr : [ { a : 1 } , { b : 2 } , { c : 3 } ] } ) | |
coll.insert( { arr : [ { a : 2 } , { b : 3 } , { c : 1 } ] } ) | |
coll.insert( { arr : [ { a : 3 } , { b : 1 } , { c : 2 } ] } ) | |
coll.ensureIndex( { arr : -1 } ) | |
coll.find().min( { arr : { a : 5000 } } ).max( { arr : { a : 1 } } ).forEach( printjson ) |
Yes - its just using $min, $max under the hood.
Is there anything else I can do regarding http://groups.google.com/group/mongodb-user/browse_thread/thread/578c6d037d241162 ? I am at a loss of how to get this working.
Looks like you didn't follow the example.
Notice the ensureIndex has a -1 rather than 1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is the find possible form the ruby driver at all? I read the source of the driver and was unable to see how its possible to run the fins with the min and max functions