Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4568

Comment on: "manual/reference/mongodb-extended-json.txt"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual

    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?

      Attachments

        Activity

          People

            allison.moore@mongodb.com Allison Reinheimer Moore
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8 years, 48 weeks, 5 days ago