LAB1 - Chapter 1 -> How do I query 2 arrays fields without position sensitive?

Hello!

I know that to query 2 array fields it’s just using $all.

But what about NOT them? I tried something like this
[{
“genres”: {$ne: [“Horror”, “Crime”]},
}]

and that

[{
"genres": {$ne: {$all: ["Horror", "Crime"] } },
}]

but i still get a “crime” inside the array of one document!

You’re probably looking for $nin

1 Like

Hi @Brian_Ito_de_Oliveira_35306,

You can refer to the documentation for more usage details:

Please let me know, if you have any questions.

Thanks,
Sonali

Hi @Brian_Ito_de_Oliveira_35306
You can use $not with $in operator or $nin operator.