[DOCS-1820] Max index name length is 125 characters (not 128) Created: 16/Aug/13  Updated: 11/Jan/17  Resolved: 20/Aug/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Trivial - P5
Reporter: Nazar Volynets Assignee: Zack Brown
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 10 years, 23 weeks ago

 Description   

In accordance to documentation http://docs.mongodb.org/manual/reference/limits/

Index Name Length
The names of indexes, including their namespace (i.e database and collection name) cannot be longer than 128 characters.

...

Max index name length is 128 but real limitation is 125 characters.

Steps to reproduce
Please use mongo shell to reproduce it:

> use test56789;
switched to db test56789
> db.createCollection("coll567890");
{ "ok" : 1 }
> db.co
db.coll567890     db.commandHelp(   db.constructor    db.copyDatabase(
> db.coll567890.getIndexes();
[
        {
                "v" : 1,
                "key" : {
                        "_id" : 1
                },
                "ns" : "test56789.coll567890",
                "name" : "_id_"
        }
]
> db.coll567890.ensureIndex({"a" : 1},{"name" : "index6789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"});
ns name too long, max size is 128

So lets calculate index name length with their alias:
<database.name> + <collection.name> + <index.name> = 9 + 1 (dot) + 10 + 108 = 128

Expected result:

  • update documentation - set 125 characters as max index name length.


 Comments   
Comment by auto [ 11/Sep/13 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1820 adding comment for future clarity
Branch: master
https://github.com/mongodb/docs/commit/d8a8e6c858e3e67a901a98a0f7aaea67e1893bec

Comment by auto [ 11/Sep/13 ]

Author:

{u'username': u'Zackrobat', u'name': u'Zack Brown', u'email': u'zack.brown@10gen.com'}

Message: DOCS-1820: Max index name length is 125 characters not 128

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/d5ad8deba04689fedb366c1fd1235b66174368f0

Generated at Thu Feb 08 07:41:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.