Reputation: 1171
i am trying to import a json file with fields containing NULL as a value
[ { 'Id' : 0, 'Client' : 85, 'Campaign' : 0, 'Location' : NULL, 'Created' : NULL, 'CardCode' : NULL, 'Mobile' : NULL, 'Message' : NULL}]
when i try to use mongoimport to input these fields into a collection
mongoimport --db dbname --collection coll filename.json --jsonArray
i get an error for the NULL value
Failed: error processing document #1: invalid character 'U' in literal NaN or Number (expecting 'a' or 'u')
what would be the right way to import these documents?
Upvotes: 2
Views: 1016
Reputation: 1171
thank you @joao.
that helped, changing the NULL to null solved the problem.
since it was a large file - i had to use sed to find and replace
Upvotes: 2