Hello all. I’m quite new with MongoDB.
I have upgraded from MongoDB v4.4 to v5.0, but I haven’t dumped my databases before.
Now the server service points to the newer version.
Hoq can I recover my old databases into the new version, without losing the other new databases that I have created in the meantime?
RESOLVED!
I was able to make it, in the following way (in Windows 11):
- Go to the directory “C:\Program Files\MongoDB\Server\5.0\bin”.
- Run the command "mongod --dbpath “C:\Program Files\MongoDB\Server\4.4\data”.
- Go to Task Manager / Services. Stop and restart Mongodb service.
- On Mongo shell (run “mongo.exe”) type “show dbs”. You should see your old databases.
- Run command “mongodump --db YourDbName” to get the dump.
- Go back to your original data directory using "mongod --dbpath “C:\Program Files\MongoDB\Server\5.0\data”.
- Restore the dump in your new data directory with Mongorestore.exe
That’s all.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.