|
This particular manifestation was fixed by a197796 under SERVER-12976, where the length of the collection name is checked as part of userAllowedWriteNS() prior to creating the collection and mutating the BSONObjBuilder& result.
It is possible to trigger this issue when running a config server and attempting to create a collection on a database other than admin, config, or local.
configsvr> db.version()
|
3.1.3
|
configsvr> db.getSiblingDB('test').mycoll.runCommand('createIndexes', {indexes: [{key: {'test': 1}, name: 'test'}]});
|
{
|
"createdCollectionAutomatically" : true,
|
"errmsg" : "can't create user databases on a --configsvr instance",
|
"code" : 14037,
|
"ok" : 0
|
}
|
However, after SERVER-17607, the contents of the BSONObjBuilder& result are no longer included in the response when an exception is thrown while executing a command. Thus, the issue with the createIndexes command mutating the BSONObjBuilder& result prior to creating the collection remains but isn't visible to the user.
configsvr> db.getSiblingDB('test').mycoll.runCommand('createIndexes', {indexes: [{key: {'test': 1}, name: 'test'}]});
|
{
|
"ok" : 0,
|
"errmsg" : "can't create user databases on a --configsvr instance",
|
"code" : 14037
|
}
|
|