0

In my collection, documents will contain a field that holds an array like so:

{
  field_a: ["banna", "orange", "kiwi"]
}

How to index this collection based on this field?

The queries will be something like:

Find all documents where field_a is a subset of a given array.

1 Answers1

1

You can create an index like this:

db.col.createIndex({ 'field_a': 1 })
NeNaD
  • 18,172
  • 8
  • 47
  • 89