[DOCS-4568] Comment on: "manual/reference/mongodb-extended-json.txt" Created: 20/Dec/14  Updated: 30/Oct/23  Resolved: 13/Mar/15

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Thomas Rueckstiess Assignee: Allison Reinheimer Moore
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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


Participants:
Days since reply: 8 years, 48 weeks, 5 days ago

 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?



 Comments   
Comment by Githook User [ 13/Mar/15 ]

Author:

{u'username': u'schmalliso', u'name': u'Allison Moore', u'email': u'allison.moore@10gen.com'}

Message: DOCS-4568: updates to extended json page

  • clarifies that you need quotes around NumberLong values or
    risk loosing accuracy (numbers can become negative)
  • updates undefined to clarify that it cannot be used in a query
    except by searching using the $type operator

adds quotes around string

Signed-off-by: Allison Moore <allison.moore@10gen.com>
Branch: v2.6
https://github.com/mongodb/docs/commit/17d50e967263ce906fb47d81c98ccd6f3cd5065a

Comment by Githook User [ 13/Mar/15 ]

Author:

{u'username': u'schmalliso', u'name': u'Allison Moore', u'email': u'allison.moore@10gen.com'}

Message: DOCS-4568: updates to extended json page

  • clarifies that you need quotes around NumberLong values or
    risk loosing accuracy (numbers can become negative)
  • updates undefined to clarify that it cannot be used in a query
    except by searching using the $type operator

adds quotes around string

Signed-off-by: Allison Moore <allison.moore@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/127b3c928e9cfea77faa0fa1897ad7f31d34f0a1

Generated at Thu Feb 08 07:48:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.