Grokking MongoDB
Vote

0% completed

​

Multikey Indexes

An index on an array field stores a separate entry for each distinct element of the array, and every one of those entries refers to the same document. MongoDB calls this a multikey index. It lets a query find a document by one element of an array, and it creates a cost that grows with the length of the array.

The genres field in this books collection holds two values per book:

db.books.insertMany([ { title: "To Kill a Mockingbird", authors: ["Harper Lee"], genres: ["Fiction", "Classic"], published: 1960 },

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content