I have a Mongo collection with an array property, and the array has "empty" objects in it. What query can I use to target these non-empty arrays that have only {}?
I've tried combinations of $exists and $where to no avail.
Examples of data I need to target:
"arrayProperty" : [ {} ]
and
"arrayProperty" : [ {}, {} ]
EDIT:
Here's an example of the schema:
{
"_id" : ObjectId("53b1ca583d597ce7cbd54646"),
"arrayProperty" : [
{
"serialNumber" : "abc123",
"rfid" : "xyz098",
"size" : 95,
"points" : 50,
"frequency" : "Every day",
"dateAssigned" : ISODate("2011-02-10T15:27:39.000Z")
}
]
}
arrayPropertycontains only{}objects? For example, shouldarrayProperty: [ {}, {a: 1} ]match?