如何NumberLong
使用 将 a 导入 MongoDB mongoimport
?
不幸的是,json 文件中的这些条目会导致错误:
{"_id": NumberLong(123)}
{"_id": NumberLong("123")}
结果:
Mon Nov 12 14:41:46 Assertion: 10340:Failure parsing JSON string near: "_id": Num
0xaf6b21 0xabe459 0xabe5dc 0x7b93ad 0x56160d 0x5630f4 0xabb412 0x5546bc 0x7f961b79776d 0x554549
mongoimport(_ZN5mongo15printStackTraceERSo+0x21) [0xaf6b21]
mongoimport(_ZN5mongo11msgassertedEiPKc+0x99) [0xabe459]
mongoimport() [0xabe5dc]
mongoimport(_ZN5mongo8fromjsonEPKcPi+0x56d) [0x7b93ad]
mongoimport(_ZN6Import8parseRowEPSiRN5mongo7BSONObjERi+0xa2d) [0x56160d]
mongoimport(_ZN6Import3runEv+0x1314) [0x5630f4]
mongoimport(_ZN5mongo4Tool4mainEiPPc+0x1712) [0xabb412]
mongoimport(main+0x2c) [0x5546bc]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f961b79776d]
mongoimport(__gxx_personality_v0+0x419) [0x554549]
Mon Nov 12 14:41:46 exception:BSON representation of supplied JSON is too large: Failure parsing JSON string near: "_id": Num
Mon Nov 12 14:41:46
Mon Nov 12 14:41:46 imported 0 objects
Mon Nov 12 14:41:46 ERROR: encountered 1 error