I had a happy MongoDB 3.0.5 installed on a VM on a Windows 2012R2 Server, for light use. I moved the VM to a new physical server without any major changes, and to my surprise it cannot be started; and I can't seem to be able to find the issue on the internet.
The error I'm getting is:
2016-07-09T02:46:26.936+0430 W STORAGE [initandlisten] database D:\mongodata MYDBNAME could not be opened due to DBException 10080: ns name too long, max size is 127 bytes
2016-07-09T02:46:26.940+0430 I STORAGE [initandlisten] exception in initAndListen: 10080 ns name too long, max size is 127 bytes, terminating
The database name is a few characters and reasonable, and it used to work. I tried upgrading MongoDB to 3.2.3; didn't work but the error is changed:
2016-07-09T03:54:25.404+0430 I - [initandlisten] Assertion: 10078:nsToDatabase: db too long
2016-07-09T03:54:26.117+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\util\stacktrace_windows.cpp(174) mongo::printStackTrace+0x43
2016-07-09T03:54:26.118+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\util\log.cpp(136) mongo::logContext+0xb0
2016-07-09T03:54:26.118+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\util\assert_util.cpp(222) mongo::msgasserted+0xfa
2016-07-09T03:54:26.118+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\catalog\database.cpp(429) mongo::Database::getCollection+0x1ab
2016-07-09T03:54:26.119+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\catalog\database.cpp(182) mongo::Database::_getOrCreateCollectionInstance+0x35
2016-07-09T03:54:26.119+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\catalog\database.cpp(214) mongo::Database::Database+0x25b
2016-07-09T03:54:26.120+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\catalog\database_holder.cpp(134) mongo::DatabaseHolder::openDb+0x380
2016-07-09T03:54:26.120+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(337) mongo::repairDatabasesAndCheckVersion+0x517
2016-07-09T03:54:26.120+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(559) mongo::_initAndListen+0xee4
2016-07-09T03:54:26.120+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(659) mongo::initAndListen+0x27
2016-07-09T03:54:26.120+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(892) mongoDbMain+0x216
2016-07-09T03:54:26.121+0430 I CONTROL [initandlisten] mongod.exe ...\src\mongo\db\db.cpp(698) wmain+0x35
2016-07-09T03:54:26.121+0430 I CONTROL [initandlisten] mongod.exe f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c(623) __tmainCRTStartup+0x10f
2016-07-09T03:54:26.121+0430 I CONTROL [initandlisten] KERNEL32.DLL BaseThreadInitThunk+0x22
2016-07-09T03:54:26.121+0430 I CONTROL [initandlisten]
2016-07-09T03:54:26.123+0430 I STORAGE [initandlisten] exception in initAndListen: 10078 nsToDatabase: db too long, terminating
2016-07-09T03:54:26.133+0430 I CONTROL [initandlisten] now exiting
I tried running mongod --repair
without any luck, it doesn't start at all. I can't have any logical explanations about what could have happened, since everything else on the server is fine.
Here's the exact changes made to the machine:
- Host name is changed
- Machine is dis-joined and then joined to the domain controller
- The IP address of the network is changed
I'll be thankful to know what could have caused this, and how can I fix it.
Best Answer
From the error it looks like you are hitting the mongodb's namespace limit 128 bytes.
One of the namespace; may be db.collection.index is 10078 is too long thus causing this issue.