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.
CodePudding user response:
You can create an index like this:
db.col.createIndex({ 'field_a': 1 })