Limitations of indexes in MongoDB

Each index not only occupies part of the memory space but also causes an overhead on each insert, update, and delete operation. So, if you rarely use your Collection for read operations, you should not use the index for it.

Extra Overhead:

Each index not only occupies part of the memory space but also causes an overhead on each insert, update, and delete operation. So, if you rarely use your Collection for read operations, you should not use the index for it.

RAM Usage:

When the index is stored in RAM, you should ensure that the total capacity of the index does not exceed the RAM limit. If the total capacity increases over the size of the RAM, it will start deleting some indexes and this causes loss of performance.

Limitations of index when used in queries

Indexes cannot be used in queries that use:

Regular Expressions or negative operators like $ nin, $ not, .

Arithmetic operators like $ mod, .

$ Where clause.

Therefore, it is good advice to check the index usage in your queries.

Index Limits Key:

Starting with version 2.6, MongoDB will not create an index if the value of an existing index is exceeded that exceeds Index Key Limit.

Insert the Document to exceed Index Key Limit

MongoDB will not insert any Document into an indexed Collection if the value of the indexed field of this Document exceeds Index Key Limit. The same thing happens with Mongorestore and Mongoimport utilities.

The maximum limit

A Collection cannot have more than 64 indexes.

The length of the index name cannot be longer than 125 characters.

A composite index may have a maximum of 31 indexed fields.

According to Tutorialspoint

Previous article: Advanced indexing activity in MongoDB

Next article: ObjectId in MongoDB

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile