Collection:
db.test.find()
{
{ "_id" : ObjectId(...), "arr" : [ "Today", "is", null ] }
{ "_id" : ObjectId(...), "arr" : [ null, null, null ] }
}
I'm trying to find all documents where all of arr equals some value. In this example, I would want the document containing arr : [null, null, null] when given null.
Find documents where ALL elements of an array have a specific value
This solution is close to what I want; however, my array data do not have keys for an $elemMatch to reference. Is there a way to accomplish this query without being unnecessarily costly or restructuring my data?
Thanks!