In this chapter, we can study Indexing Limitations and its other additives.
Extra Overhead
Every index occupies a few space in addition to reasons an overhead on every insert, update and delete. So in case you rarely use your series for read operations, it makes sense no longer to apply indexes.
RAM Usage
Since indexes are saved in RAM, you have to make sure that the full size of the index does now not exceed the RAM restrict. If the whole length increases the RAM size, it'll start deleting a few indexes, causing overall performance loss.
Query Limitations
Indexing can't be used in queries which use −
- Regular expressions or negation operators like $nin, $now not, and many others.
- Arithmetic operators like $mod, and many others.
- $in which clause
Hence, it's miles continually really useful to check the index utilization for your queries.
Index Key Limits
Starting from model 2.6, MongoDB will not create an index if the fee of current index subject exceeds the index key limit.
Inserting Documents Exceeding Index Key Limit
MongoDB will not insert any report into an indexed collection if the indexed discipline cost of this document exceeds the index key restriction. Same is the case with mongorestore and mongoimport utilities.
Maximum Ranges
- A collection can not have more than sixty four indexes.
- The period of the index call cannot be longer than a hundred twenty five characters.
- A compound index can have maximum 31 fields indexed.