I'm Having trouble with setting up a query - it is an array of objects, and I'm looking at a specific index. So my Schema has a field that is an array of objects:
{userID: ObjectID,
someArray: [{foo: "bar"},{bar: "foo"}]}
I'd like to return either all records where the first element in SomeArray has a non-empty object or where someArray does not contain null.
Ive tried using:
db.find({someArray: {$exists: true, $not: {$size: 0}} })
however often someArray has a null object in it so that doesn't work. If all fails I could potentially cache the entire collection and filter with raw javascript though that might not be the ideal way of doing it.