Limitations of indexes in MongoDB
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
You should read it
May be interested
- Learn about security features and authentication in MongoDBin the following article, we will continue to introduce security and authentication features in the mongodb database management system series. in essence, the basic account validation feature is available in mongodb, but has been disabled in default mode, and in this mode the system requires at least 1 active database ...
- ObjectId in MongoDByou have seen the use of mongodb objectid in previous chapters. in this chapter, we will understand the structure of objectid.
- How to create the index on the bottom, write the exponent in Wordcreating an upper, lower or exponential index in word is a basic operation when presenting content in word, especially when presenting math or chemistry content.
- Shard in MongoDBsharding is a process of storing data records across multiple devices and it is a method of mongodb to meet the requirement for increasing data. when the size of the data increases, a single device cannot be enough to store data.
- Learn about Java Driver in MongoDBin the following article, we will introduce you some basic features of mongodv java driver as well as how to deploy and apply in practice.
- Install MongoDBinstructions for installing mongodb on windows.
- Map Reduce in MongoDBin mongodb documentation, map-reduce is a data processing system that condenses a large amount of data into useful overall results. mongodb uses mapreduce command for map-reduce operation. in general, map reduce is used to handle large data sets.
- Aggregation in MongoDBaggregation can be understood as aggregation. the aggregation operation handles data records and returns calculated results. the operations group the values from multiple documents together, and can perform multiple operations on the grouped data to return a single result. in sql, count (*) and group by are equivalent to aggregation in mongodb.
- Data modeling in MongoDBdata in mongodb has a flexible schema. documents in the same collection need not have the same set of fields or structures, and common fields in collection documents can keep different data types.
- How to use Aggregation Pipeline in MongoDBif you are using mongodb's mapreduce, it is best to switch to aggregation pipeline for more efficient computation.