In Tutorial: Create and Query an Atlas Search Index we provide an example that indexes an array, but do not explicitly call out that we are indexing an array. We have received a number of questions on how to index arrays using Atlas Search. So customers are not finding this example. We should add a section on how to index arrays using Atlas Search. For reference the following explanation was provided to customers, which they found helpful:
For example, in the sample_mflix database, movies contain a genres array. (Only showing title and genres to highlight that genres is an array of strings.)
We then define an index on genres, once again focusing on the genres portion of the index definition:
Note how the type is string and not array, array[string], string, or some other syntax. We define the index as the data type of the array elements and do not have to specify that the data is contained in an array. The fact that it is an array is automatically detected and handled by MongoDB.