A query needs to be a valid JSON document.
As such, an array of values must be between brackets. See JSON - Wikipedia for details. In this case, it should be [ 'Crime' , 'Horror' ]'
But $ne is not the appropriate operator as it means strictly not equal. To illustrate start with the collections:
{ _id: 1, a: [ 2, 3 ] }
{ _id: 2, a: [ 3, 2 ] }
{ _id: 3, a: [ 2, 3, 4 ] }
and run the query
c.find( { a : { '$ne' : [ 2 , 3 ]}})
and you will get
{ _id: 2, a: [ 3, 2 ] }
{ _id: 3, a: [ 2, 3, 4 ] }
Which is not what you want in this case.
See https://docs.mongodb.com/manual/tutorial/query-arrays/ to find out the appropriate operator.
1 Like
oh thanks a lot, that explanation really helped
1 Like
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.