Introduction to MongoDb with .NET part 34: indexing subdocuments
May 25, 2016 Leave a comment
Introduction
In the previous post we looked at how to index arrays in MongoDb using the client shell. We saw that there wasn’t anything special in the JSON syntax, it is the same as when adding an index to a scalar field. There’s a limitation to indexing array fields though. We cannot index two or more array fields, only one at a time. It’s fine to index as many scalar fields as you want plus one array field, but not more than that.
In this post we’ll see how to index fields within subdocuments.