Reputation: 150
I am using django 2.2 and mongodb as database for backend. i have inserted all data in my application.I am also using Robo3T for seeing collections of mongodb database.My database name is CIS_FYP_db. In my computer everything is going perfect but i want to transfer that project into another computer while i am transferring the project which also contains data\db file with many collections.wt files but when i am running that project in other computer it is showing me that database is blank.No data were present there and mongodb is making new database with the same name CIS_FYP_db with no collections.Please help me to solve this problem that how can i transfer my mongodb database into other computer so i can use it into my application which is already made for that database.Thanks in advance
DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'CIS_FYP_db', } }
Upvotes: 2
Views: 3482
Reputation: 21
Assumption: you have setup mongoDb locally and want to migrate it to another computer.
sometime path is not set, so try this in cmd prompt: set path="C:\Program Files\MongoDB\Server\5.0\bin"
Note: please refactor the link according to your folder path.
Note: make sure you follow Step 1
we are going to create dump of mongodb from old pc(using mongodump), then transfer that dump to new pc, and import that dump using mongorestore.
mongodump --host localhost:27017 --out ~/Desktop/mongo-migration
--username [yourUserName] --password [yourPassword] --authenticationDatabase admin
mongorestore C:/....../mongo-migration/ -u root --host 127.0.0.1:27017
Upvotes: 2
Reputation: 99
When you create a connection with mongodb then database is created automatically if not exist already. You can use mongodump command to get all the database records and mongorestore to restore your database on your new machine.
Upvotes: 1