Match only where array field contains certain values and exclude from match if it contains any others

Below I have linked an example of a query I am trying to run. I’m only trying to get back documents that have both Japanese and English in the languages array field, but I don’t want documents that have other languages. The logical $all operator doesn’t cover this use case, and I’m trying to figure out if there is another operator that will. I know I can do this with an aggregation pipeline, but I wondering if it could also be done in a simple find. Any assistance would be appreciated. Thanks.

  languages: { $all: ["Japanese", "English"] }
   languages: { $all: ["Japanese", "English"], $size: 2 } 
1 Like

Hi @Carter_79898,

The following query should also help:

db.movies.find({ languages: [“Japanese”, “English”]})