Databases Reference
In-Depth Information
{"x" : "foobar"}
symbol
This type is not supported by the shell. If the shell gets a symbol from the database,
it will convert it into a string.
object id
An object id is a unique 12-byte ID for documents. See the section “_id and Ob-
jectIds” on page 20 for details:
{"x" : ObjectId()}
date
Dates are stored as milliseconds since the epoch. The time zone is not stored:
{"x" : new Date()}
regular expression
Documents can contain regular expressions, using JavaScript's regular expression
syntax:
{"x" : /foobar/i}
code
Documents can also contain JavaScript code:
{"x" : function() { /* ... */ }}
binary data
Binary data is a string of arbitrary bytes. It cannot be manipulated from the shell.
maximum value
BSON contains a special type representing the largest possible value. The shell does
not have a type for this.
minimum value
BSON contains a special type representing the smallest possible value. The shell
does not have a type for this.
undefined
Undefined can be used in documents as well (JavaScript has distinct types for null
and undefined):
{"x" : undefined}
array
Sets or lists of values can be represented as arrays:
{"x" : ["a", "b", "c"]}
embedded document
Documents can contain entire documents, embedded as values in a parent
document:
{"x" : {"foo" : "bar"}}
 
Search WWH ::




Custom Search