We have been using $ne: null
with our array fields(object type) for mongo queries instead of $exists: true
. Problem is when using $ne
, it doesn’t give the right result. The code is in Node where it is not working. Plus when we tried with compass, it worked with correctly in mine, but didn’t in my collugue’s. Not sure what is happening.
Example query:
Document
``` [{name: ‘Event1’, ‘arrayfield’: [{id: ‘id1’}]}]`
Query
{arrayField.eID: {$exists: true}}` // works
{arrayField.eID: {$ne: null}}` // doesn’t work