I encountered this error after trying to restore 2.1 mongodumps. (This happened only after installing mongodb 2.2.0):
The Error:
Wed Sep 19 18:33:26 Assertion failure b.empty() src/mongo/db/json.cpp 645
0x10036b5fb 0x10009ad86 0x1004af6f2 0x100016f85 0x100016944 0x100016944 0x100019e54 0x100313b5d 0x100315697 0x10000126a 0x1000011e4
0 mongorestore 0x000000010036b5fb _ZN5mongo15printStackTraceERSo + 43
1 mongorestore 0x000000010009ad86 _ZN5mongo12verifyFailedEPKcS1_j + 310
2 mongorestore 0x00000001004af6f2 _ZN5mongo8fromjsonEPKcPi + 1634
3 mongorestore 0x0000000100016f85 _ZN7Restore9drillDownEN5boost11filesystem210basic_pathISsNS1_11path_traitsEEEbbb + 4117
4 mongorestore 0x0000000100016944 _ZN7Restore9drillDownEN5boost11filesystem210basic_pathISsNS1_11path_traitsEEEbbb + 2516
5 mongorestore 0x0000000100016944 _ZN7Restore9drillDownEN5boost11filesystem210basic_pathISsNS1_11path_traitsEEEbbb + 2516
6 mongorestore 0x0000000100019e54 _ZN7Restore5doRunEv + 3140
7 mongorestore 0x0000000100313b5d _ZN5mongo8BSONTool3runEv + 1325
8 mongorestore 0x0000000100315697 _ZN5mongo4Tool4mainEiPPc + 5447
9 mongorestore 0x000000010000126a main + 58
10 mongorestore 0x00000001000011e4 start + 52
The Cause:
The offending file is the <dump directory/<database>/<collection>.metadata.json file. It has a line like so:
{options : { "create" : <database>, undefined, undefined, undefined }, indexes:[{ "v" : 1, "key" : { "_id" : 1 }, "ns" :<database>, "name" : "_id_" }]}
The “undefined,undefined,…” is an artifact from 2.1 beta.
The Cure:
Delete the “, undefined, undefined, undefined” and save the json metadata file and rerun the mongorestore.
You might have to do this for a few databases. You can see which data base by looking at the line before the error message like so:
Wed Sep 19 18:33:26 <dump directory>/<database>/<collection>.bson Wed Sep 19 18:33:26 going into namespace [<database>.<collection>] Wed Sep 19 18:33:26 Assertion failure b.empty() src/mongo/db/json.cpp 645
Cheers
<k/>
after editing the json file I got: “User Assertion: 15934:JSON object size didn’t match file size
assertion: 15934 JSON object size didn’t match file size”
I also got this error after editing the json file.
Did anyone ever resolve the assertion: 15934 JSON object size didn’t match file size error.