0
votes

I'm trying to restore a mongo dump but got an error:

"2020-12-21T01:43:22.398-0300 Failed: namedb.namecollection: error restoring from \namedb\namecollection.bson: (InvalidBSON) not null terminated string in element with field name 'url' in object with _id: ObjectId('5fded20599e3604d10bb2adf')"

Then the mongorestore imports only 8000 documents, but my dump has above 150k documents.

Any idea?

Mongodb version: 4.2.4 community

1

1 Answers

0
votes

I solved!

  1. Convert bson to json: bsondump.exe --outFile=collection.json mycol.bson

this step skips all documents with problems

  1. Import to mongo: mongoimport.exe --db=mydb --collection=mycol --file=collection.json