Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
*Location*: http://docs.mongodb.org/manual/reference/mongodb-extended-json/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.45 Safari/537.36
*Referrer*: https://www.google.com.au/
*Screen Resolution*: 2560 x 1440
*repo*: docs
*source*: reference/mongodb-extended-json
*Location*: http://docs.mongodb.org/manual/reference/mongodb-extended-json/ *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.45 Safari/537.36 *Referrer*: https://www.google.com.au/ *Screen Resolution*: 2560 x 1440 *repo*: docs *source*: reference/mongodb-extended-json
Description
Two issues with this page
NumberLong
NumberLong( <number> )
|
This needs to be
NumberLong("<number>")
|
with quotes. Otherwise it will interpret the number as a floating point number, which converts to a different number (not enough accuracy) and return the wrong result.
// shell
|
> db.foo.find({long: NumberLong(9223372036854775807) })
|
|
|
// shows this in the log
|
2014-12-20T21:20:43.376+1100 [conn4] query test.foo query: { long: -9223372036854775808 } planSummary: EOF ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:0 keyUpdates:0 numYields:0 locks(micros) r:36 nreturned:0 reslen:20 0ms
|
Compare to:
// shell
|
> db.foo.find({long: NumberLong('9223372036854775807') })
|
|
|
// log file
|
2014-12-20T21:21:25.368+1100 [conn4] query test.foo query: { long: 9223372036854775807 } planSummary: EOF ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:0 keyUpdates:0 numYields:0 locks(micros) r:35 nreturned:0 reslen:20 0ms
|
undefined
Can't seem to use undefined as a value in queries:
> db.foo.find({a: undefined})
|
error: {
|
"$err" : "Can't canonicalize query: BadValue cannot compare to undefined",
|
"code" : 17287
|
}
|
Is this obsolete?