mongodb索引长度限制

mongodb索引长度限制

集合中索引不能超过64个
索引名的长度不能超过128个字符
一个复合索引最多可以有31个字段
可以使用db.collection.ensureIndex({indexName:1},{name:”xxxIndexName”})指定name的长度。

Number of Indexes per Collection
A single collection can have no more than 64 indexes.
Index Name Length

Fully qualified index names, which includes the namespace and the dot separators (i.e. ..$), cannot be longer than 128 characters.

By default, is the concatenation of the field names and index type. You can explicitly specify the to the createIndex() method to ensure that the fully qualified index name does not exceed the limit.

Number of Indexed Fields in a Compound Index
There can be no more than 31 fields in a compound index.

原文地址:https://www.cnblogs.com/thewindkee/p/12873219.html