Unexpected output

Good morning kanika mam

plzz help me with this .

The most important question is, “what do you want help with”?

  • What is the problem you’re experiencing?
  • Why is this output not what you expected?
  • What did you expect to happen?
  • What did you do to produce this output?

Kanika may know a lot, but they’re not a mind-reader :wink:

db.movieDetails.find({rated: {$nin: ["PG", "R"]}}, {title: 1, rated: 1}).pretty()

1 Like

thanks for replying.
but i wanna know why my solution is incorrect. there must be some hidden concept.

If you want to multiple conditions on the same field you need to use $and (in some cases $in/$nin) operator. Otherwise you only query on last condition ($ne: “R” is your case).

1 Like