Database · Medium
How does indexing work in MongoDB? Single field, compound, multikey, TTL, and text indexes.
DatabaseNoSQLSeniorMongoDB
Answer preview
MongoDB indexes are B-trees over one or more fields. Without one, a query is a COLLSCAN that reads every document; with one it becomes an IXSCAN. Every collection has a mandatory unique index on _id.…