title: How do I create a usable index for an array of objects using pouchdb-find?
body: <p>I only want to get data with <b>groups</b> that match at least with one of those <b>groupIDs</b>. I have tried a few solutions but I still did it wrong. Assuming we have data like this.</p>
  <pre><code>const groupIDs = ['124', '245', '678', '999', '111'];
  
  const data = [
    {
      _id: 'example:123',
      _rev: 'example',
      name: 'John',
      groups: [
        { groupID: '124', type: 'ADMIN' },
        { groupID: '345', type: 'PRACTITIONER' },
        { groupID: '678', type: 'PATIENT' },
      ]
    },
    {
      _id: 'example:456',
      _rev: 'example2',
      name: 'Yoda',
      groups: [
        { groupID: '124', type: 'ADMIN' },
        { groupID: '345', type: 'PRACTITIONER' }
      ]
    },
  ];
  </code></pre>
  <p>This is my attempt:</p>
  <pre><code>db.createIndex({
    index: { fields: ['groups.[].groupID'] }
  })
  .then((result) =&gt; {
    db.find({
      selector: { groups.groupID: { $in: groupIDs } },
      use_index: results.name
    })
  })
  </code></pre>