MongoDB Documentation, Release 3.0.4 4.4.5 BSON Types This operation will return the following hexadecimal string: 507f191e810c19729de860ea To return the hexadecimal string representation of an ObjectId() , use the valueOf() method as follows: ObjectId("507f191e810c19729de860ea").valueOf() This operation returns the following output: 507f191e810c19729de860ea To return the string representation of an ObjectId() object (in the form of a string literal ObjectId(...) ), use the toString() method as follows: ObjectId("507f191e810c19729de860ea").toString() This operation will return the following string output: ObjectId("507f191e810c19729de860ea") BSON is a binary serialization format used to store documents and make remote procedure calls in MongoDB. The BSON specification is located at bsonspec.org$^{28}$. BSON supports the following data types as values in documents. Each data type has a corresponding number that can be used with the $type operator to query documents by BSON type. To determine a field’s type, see Check Types in the mongo Shell (page 269). If you convert BSON to JSON, see the Extended JSON reference. $^{28}$http://bsonspec.org/ 178 Chapter 4. Data Models Type Number Notes Double 1 String 2 Object 3 Array 4 Binary data 5 Undefined 6 Deprecated. Object id 7 Boolean 8 Date 9 Null 10 Regular Expression 11 JavaScript 13 Symbol 14 JavaScript (with scope) 15 32-bit integer 16 Timestamp 17 64-bit integer 18 Min key 255 Query with -1 . Max key 127