Skip to content

DOCS-4568: updates to extended json page #2209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions source/reference/mongodb-extended-json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,30 @@ Undefined Type

The representation for the JavaScript/BSON undefined type.

You *cannot* use ``undefined`` in query documents.
Consider the following document inserted into the ``people`` collection:

.. code-block:: sh

db.people.insert( { name : "Sally", age : undefined } )

The following queries return an error:

.. code-block:: sh

db.people.find( { age : undefined } )
db.people.find( { age : ( $gte : undefined ) } )

However, you can query for undefined values using :query:`$type`, as
in:

.. code-block:: sh

db.people.find( { age : { $type : 6 } } )

This query returns all documents for which the ``age`` field has
value ``undefined``.

MinKey
~~~~~~

Expand Down Expand Up @@ -379,6 +403,25 @@ NumberLong

- .. code-block:: none

NumberLong( <number> )
NumberLong( "<number>" )

``NumberLong`` is a 64 bit signed integer. You must include quotation
marks or it will be interpreted as a floating point number, resulting
in a loss of accuracy.

For example, the following commands insert ``9223372036854775807`` as a
``NumberLong`` with and without quotation marks around the integer value:

.. code-block:: sh

db.json.insert( { longQuoted : NumberLong("9223372036854775807") } )
db.json.insert( { longUnQuoted : NumberLong(9223372036854775807) } )

When you retrieve the documents, the value of ``longUnquoted`` has
changed, while ``longQuoted`` retains its accuracy:

.. code-block:: sh

Number long is a 64 bit signed integer.
db.json.find()
{ "_id" : ObjectId("54ee1f2d33335326d70987df"), "longQuoted" : NumberLong("9223372036854775807") }
{ "_id" : ObjectId("54ee1f7433335326d70987e0"), "longUnquoted" : NumberLong("-9223372036854775808") }