I can query for all the documents in a Mongo collection based on the number of elements in a list like this:
db.myCollection.find( { arrayField : { $size : 0 } } )
But this doesn't work for Maps. How can I query the number of elements in a Map?
Hoepfully this example of 2 records in Mongo gives more information into what I am asking.
{
"_id" : 1,
stringField : "someValue",
arrayField : [ 1, 2, 3 ],
mapField : {
"key1" : "value1",
"key2" : "value2"
}
}
{
"_id" : 2,
stringField : "someValue2",
arrayField : [ 4 ],
mapField : {
}
}
What is the query to retrieve all the documents in the above collection using the fact that mapField has 0 elements? In the above example it should return the record with id of 2.