The $type query operator should accept the following string aliases:
Double (1) - "double"
String (2) - "string"
Object (3) - "object"
Array (4) - "array"
Binary data (5) - "binData"
Undefined (6) - "undefined"
Object id (7) - "objectId"
Boolean (8) - "bool"
Date (9) - "date"
Null (10) - "null"
Regular Expression (11) - "regex"
DBPointer (12) - "dbPointer"
JavaScript (13) - "javascript"
Symbol (14) - "symbol"
JavaScript (with scope) (15) - "javascriptWithScope"
32-bit integer (16) - "int"
Timestamp (17) - "timestamp"
64-bit integer (18) - "long"
Min key (255) - "minKey"
Max key (127) - "maxKey"
Example:
> db.coll.drop() > db.coll.insert({_id: 1, num: NumberInt('123')}) > db.coll.insert({_id: 2, num: NumberLong('123')}) > db.coll.find({num: {$type: "int"}}) { "_id" : 1, "num" : 123 } > db.coll.find({num: {$type: "long"}}) { "_id" : 2, "num" : NumberLong(123) }
- is depended on by
-
SERVER-19243 Allow $type to support "number" as type value
- Closed
- related to
-
SERVER-20345 Support additional queries with $type=number partial indexes
- Backlog