1

I want find in this document groups:

      "document": {
        "groups": [
          {
            "id": "5ccd5f7f34f82b0e3315b2f6"
          },
          {
            "id": "73b43unbfkfmdmddfdf84jjk"
          }
         ]
      }

are contains some of my query array groups ID:

[ '5ccd5f7f34f82b0e3315b2f6',
 '5cdeded7ace07216f5873b5d',
 '5cdee5d114edac2cc00bb333' ]
snakom23
  • 199
  • 3
  • 13
  • Could you please share your document/schema and your desired result. – Jitendra May 18 '19 at 09:07
  • Possible duplicate of [Query for a field in an object in array with Mongo?](https://stackoverflow.com/questions/17075205/query-for-a-field-in-an-object-in-array-with-mongo) – Vikash_Singh May 18 '19 at 10:41

1 Answers1

1

A simple find query suffices:

db.collection.find({ 'groups.id' : {$in : [ '5ccd5f7f34f82b0e3315b2f6',
                                            '5cdeded7ace07216f5873b5d',
                                            '5cdee5d114edac2cc00bb333' ] }})
Tom Slabbaert
  • 21,288
  • 10
  • 30
  • 43