All of the drivers support the full range of query commands though the syntax may be awkward at times.
See here: http://www.mongodb.org/display/DOCS/min+and+max+Query+Specifiers
I also found this as my first hit on google:
http://osdir.com/ml/mongodb-user/2010-01/msg01141.html
Looks to me like that query could be written in ruby as follows...
o = OrderedHash.new
o['$query'] = {}
o['$min'] = {'today_scores' => {'#rails' => 5000}}
o['$max'] = {'today_scores' => {'#rails' => 1}}
social_users.find(o, :fields => ['login', 'today_scores'], :limit => 100)
That's a bit awkward. :-\
cr
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
put the query in like I showed in my response. If you want, print out the query hash that you will pass to the #find command and compare it to the one you have been trying. Notice they are very different.
"{\"$query\"=>{}, \"$min\"=>{\"today_scores\"=>{\"#rails\"=>5000}}, \"$max\"=>{\"today_scores\"=>{\"#rails\"=>1}}}"
versus
"{\"today_scores.#rails\"=>{\"$max\"=>1}}"
The top one is correct.
cr
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
cr
Javascript has no notion of integers, only floats. So if you insert a record via ruby that uses integers and then try to query for it from the mongo console, I don't think you'll get anything back. Try writing the query you showed below in ruby and see if it returns what you expect. If so, then it's a datatype problem.
This is a "flaw" in the mongo console since *all* of the drivers preserve datatypes when they can during insert.
cr
You can still use $inc : { "arr.b" : 5 } to update - so performance
shouldn't change.
-1 vs 1 should not error. its the equivialnt of saying ( a > 3 && a <
3 ) that just gives you no results, not an error