MongoDB Documentation, Release 3.0.4 MongoDB permits documents within a single collection to have fields with different BSON types. For instance, the following documents may exist within a single collection. 11.2.13 What is the compare order for BSON types? db.test.insert( {x : 3 } ); db.test.insert( {x : 2.9 } ); db.test.insert( {x : new Date() } ); db.test.insert( {x : true } ); 751 11.2. FAQ: MongoDB for Application Developers MongoDB sorts BinData in the following order: Consider the following mongo example: With arrays, a less-than comparison or an ascending sort compares the smallest element of arrays, and a greater-than comparison or a descending sort compares the largest element of the arrays. As such, when comparing a field whose value is a single-element array (e.g. [ 1 ] ) with non-array fields (e.g. 2 ), the comparison is between 1 and 2 . A comparison of an empty array (e.g. [ ] ) treats the empty array as less than null or a missing field. The comparison treats a non-existent field as it would an empty BSON Object. As such, a sort on the a field in documents { } and { a: null } would treat the documents as equivalent in sort order. Changed in version 3.0.0: Date objects sort before Timestamp objects. Previously Date and Timestamp objects sorted together. MongoDB treats some types as equivalent for comparison purposes. For instance, numeric types undergo conversion before comparison. When comparing values of different BSON types, MongoDB uses the following comparison order, from lowest to highest: { x: "string" } { x: 42 } 1. MinKey (internal type) 2. Null 3. Numbers (ints, longs, doubles) 4. Symbol, String 5. Object 6. Array 7. BinData 8. ObjectId 9. Boolean 10. Date 11. Timestamp 12. Regular Expression 13. MaxKey (internal type) 1. First, the length or size of the data. 2. Then, by the BSON one-byte subtype. 3. Finally, by the data, performing a byte-by-byte comparison.