Mongorestore error "don't know what to do with file... .bjson and .json"

Hello,
I am trying to use the command line cmd mongorestore to restore a backup of a mongoDB database I have. Will this restore not work with the Atlas Cluster? The original DB was just a normal localized server database.

The error I am getting is:
don’t know what to do with file “/dev/channels.bson”, skipping…
don’t know what to do with file “/dev/channels.metadata.json”, skipping…

Any help would help! Thanks

It would help us help you if you provide the following information:

Version of the Atlas cluster you are restoring to
Version of mongorestore you are using
Was mongodump the same version?
Exact command you are running when you get this error.

Usually this happens when you point mongodump at a subdirectory inside the full dump without specifying which namespace you want it to restore to, but I’m just guessing - if you provide full details, it may be more clear what the issue is.

Asya

1 Like

Use -db flag in your mongorestore command

4 Likes

Thanks, it worked for me as well. But we need to pass command with -d insteed of -db.

1 Like

-d databaseName, now data will be restored in databaseName database.

@Ramachandra_Tummala I am facing same issue, i have used below command to restore

mongorestore --nsInclude dbname --ssl --host=“hostname:27017” --usernam
e= --password= --authenticationDatabase=admin --sslCAFile rds-combined-ca-bundle.pem --gzip /path/

Can you please help me on this issue?

just dbname will not work for nsInclude
–nsInclude=

Try nsInclude=“dbname.*”

Hi @Ramachandra_Tummala

I have tried as you said the above command i am getting same error, Please find the below restore command for your reference.

mongorestore --nsInclude="dbname" --ssl --host=“hostname:27017” --username=username --password=password --authenticationDatabase=admin --sslCAFile rds-combined-ca-bundle.pem /root/livedb/*

1 Like

Where is dbname.* in your command

If your are restoring one collection
nsInclude=dbname.collection_name
If it is full DB you have to use wildcard (*)
Please check this link having some examples

I have used above command, and getting same thing, may be version problem?