
The last five datatypes (date, object id, binary data, regex, and JavaScript code) are non-JSON datatypes; specifically, they are special datatypes that BSON allows you to use. These are a bit unusual and I doubt i’ll ever need them,
String: This commonly used datatype contains a string of text (or any other kind of
characters). This datatype is used mostly for storing text values (e.g., “Country” :
“UK”}.
• Integer (32b and 64b): This type is used to store a numerical value (e.g., { “Rank” :
1 } ). Note that the integer isn’t encapsulated by quotes
• Boolean: This datatype can be set to either TRUE or FALSE.
• Double: Used to store floating point values.
• Min / Max keys: Used to compare a value against the lowest and highest BSON elements, respectively.
• Arrays: This datatype is used to store arrays (e.g., ["MongoDB", "CouchDB" ,"Cassandra"]).
• Timestamp: Used to store a timestamp. This can be handy for recording when a document has been modified or added.
• Object: This datatype is used for embedded documents.
• Null: Used to store a Null value.
• Symbol: This datatype is used identically to a string (see above); however, it’s
generally reserved for languages that use a specific symbol type.
• Date *: This datatype is used to store the current date or time in UNIX time format
• Object ID *: This datatype is used to store the document’s ID.
• Binary data *: Used to store binary data.
The spec is here: http://bsonspec.org/#/specification
Be careful with max sizes for integers and floats. And, of course, text encoding.