There is such a group of data, want to find to the second group, namely array type data, the appropriate query conditions
{
"_id" : ObjectId("57986ddab806c2490e67abdc"),
"test" : "this a test",
}
{
"_id" : ObjectId("57986ddab806c2490e67abdd"),
"test" : [
"this a test"
],
}
Use $type yourself, but only find to
//find
db.data.find( { test: { $type: “array” } } )
//result
{
"_id" : ObjectId("57986ddab806c2490e67abdd"),
"test" : [
[
"this a test"
]
],
}
The requirement is met by using the field array length condition.
db.data.find( { test: { $size: 1 } } )