How to Implement mongodb not Nested or/and Query

  mongodb, question

In the form of A and not (B or C)
The database record structure is:
If you want to query the above structure, for example, you want to find:3 is in the pic, and 7 or 9 is not in the pic field..
There are a total of 4 no operators in mongodb, which are $not $nin $nor $ne respectively

among them$neNot suitable for arrays, i.e. pic:{$ne:[7]} cannot implement a meaning similar to pic:{$nin:[7]}.
And$ninCannot nest or or and operators in, that is, pic:{$nin:{$or:[{pic:7}]}} will report an error.

So how should queries be used to implement not operations?Ask for advice ~

db.test.find({$and: [{pic: 3}, {$nor: [{pic: 7}, {pic: 9}]}]})