@@ -294,6 +294,30 @@ Undefined Type
294
294
295
295
The representation for the JavaScript/BSON undefined type.
296
296
297
+ You *cannot* use ``undefined`` in query documents.
298
+ Consider the following document inserted into the ``people`` collection:
299
+
300
+ .. code-block:: sh
301
+
302
+ db.people.insert( { name : Sally, age : undefined } )
303
+
304
+ The following queries return an error:
305
+
306
+ .. code-block:: sh
307
+
308
+ db.people.find( { age : undefined } )
309
+ db.people.find( { age : ( $gte : undefined ) } )
310
+
311
+ However, you can query for undefined values using :query:`$type`, as
312
+ in:
313
+
314
+ .. code-block:: sh
315
+
316
+ db.people.find( { age : { $type : 6 } } )
317
+
318
+ This query returns all documents for which the ``age`` field has
319
+ value ``undefined``.
320
+
297
321
MinKey
298
322
~~~~~~
299
323
@@ -379,6 +403,25 @@ NumberLong
379
403
380
404
- .. code-block:: none
381
405
382
- NumberLong( <number> )
406
+ NumberLong( "<number>" )
407
+
408
+ ``NumberLong`` is a 64 bit signed integer. You must include quotation
409
+ marks or it will be interpreted as a floating point number, resulting
410
+ in a loss of accuracy.
411
+
412
+ For example, the following commands insert ``9223372036854775807`` as a
413
+ ``NumberLong`` with and without quotation marks around the integer value:
414
+
415
+ .. code-block:: sh
416
+
417
+ db.json.insert( { longQuoted : NumberLong("9223372036854775807") } )
418
+ db.json.insert( { longUnQuoted : NumberLong(9223372036854775807) } )
419
+
420
+ When you retrieve the documents, the value of ``longUnquoted`` has
421
+ changed, while ``longQuoted`` retains its accuracy:
422
+
423
+ .. code-block:: sh
383
424
384
- Number long is a 64 bit signed integer.
425
+ db.json.find()
426
+ { "_id" : ObjectId("54ee1f2d33335326d70987df"), "longQuoted" : NumberLong("9223372036854775807") }
427
+ { "_id" : ObjectId("54ee1f7433335326d70987e0"), "longUnquoted" : NumberLong("-9223372036854775808") }
0 commit comments