Introduction to MongoDb with .NET part 33: indexing arrays
May 24, 2016 Leave a comment
Introduction
In the previous post we looked at compound indexes in MongoDb. Compound indexes can be useful if you’d like to make multi-field searches more efficient. E.g. if there’s a frequent search with a filter on “name” and “age” then a compound index is a good candidate to make the search more efficient. The exact sequence of the keys in the compound definition is important. The leftmost key is the primary key, followed by the secondary key and so on. A search on the secondary key field won’t use the compound index.
In this post we’ll look at indexing array fields.