-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
db.test.insert({a:1});
db.test.insert({a:"1"});
--------------------------------------------------------------------------------------------------------
> db.test.find({a:{$type:"string"}})
{ "_id" : ObjectId("582420b599ec5f9dcc617115"), "a" : "1" }
> db.test.find({a:{$type:"number"}})
{ "_id" : ObjectId("582420ad99ec5f9dcc617114"), "a" : 1 }
No issues as of now, How can i select both string and numbers with in query
> db.test.find({a:{$type:{$in:["string","number"]}}})
Error: error: {
"waitedMS" : NumberLong(0),
"ok" : 0,
"errmsg" : "argument to $type is not a number or a string",
"code" : 14
}