[DOCS-7649] mongorestore bug Created: 14/Apr/16  Updated: 30/Oct/23  Resolved: 20/Oct/17

Status: Closed
Project: Documentation
Component/s: tools
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Allison Reinheimer Moore
Resolution: Incomplete Votes: 0
Labels: collector-298ba4e7, docs-triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 14.04 server
MongoDB version 2.4.9 last package from apt-get

Location: https://docs.mongodb.org/manual/reference/program/mongorestore/#bin.mongorestore
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Referrer: https://docs.mongodb.org/manual/tutorial/backup-and-restore-tools/
Screen Resolution: 1920 x 1080
repo: docs
source: reference/program/mongorestore


Participants:
Days since reply: 7 years, 43 weeks, 6 days ago

 Description   

I dumped my database with mongodump and then tried to restore it with mongorestore on other server with other mongodb installation. But I found unexpected behavior: first time when I runned mongorestore the database was restored correctly, but after I restarted mongodb server (there was need to change the bind IP), removed imported database and tried to import it again, it was imported without specified in --db argument database name but as parent directory name of backup. Then, I changed command for restore and tried again - and mongorestore restored correctly.

I tested some variants of mongorestore command (including ommiting the --db argument and leaving the backup directory as last argument) and found that after restarting the mongodb daemon it doesn't matter what is changed in command - correct restoring is always after changing command.



 Comments   
Comment by Allison Reinheimer Moore [ 14/Apr/16 ]

Thanks, and you're using MongoDB 2.4?

Comment by Alex Furnica [ 14/Apr/16 ]

Of course.
Dump:

# mongodump --db mydb --out ./_db

Restore:

# mongorestore --db mydb --dir ./_db

The problem was that the first time when I tried to restore, it restored correctly in mydb database, but after restarting mongodb server, removing restored db and tried again - it restored in _db database, even in -db argument was mydb. But, as I sayed, if now I change something in command, for example, add the -host 127.0.0.1, mongorestore will correctly restore it in mydb database

P.S. All theese commands I wrote in a bash script, and executed it. Now I tried it again, but direct from terminal. After that the problem temporary disappear..

Comment by Allison Reinheimer Moore [ 14/Apr/16 ]

alex025 Can you provide the mongorestore commands that you ran when you observed the expected and unexpected behaviour? I'm having some trouble understanding what issue you've had. Thanks!

Generated at Thu Feb 08 07:54:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.