Updating Local Database
Step 1: Export the MongoDB Atlas Database
First, you need to export your MongoDB Atlas database to a BSON (Binary JSON) file. You can use the mongodump tool for this. Make sure you have your own Mongo Atlas URL (should be given by James)
-
Export the Database: Use
mongodumpto export your database. ReplaceMONGO_URLwith the MONGO_URL variable in the.envfile in/backend.mongodump --uri="MONGO_URL" --out=/path/to/dumpnoteYour path to dump is just a temporary storage location so the location isn't very important. A good example would be
C:\Users\<usename>\dumpReplace
your-atlas-connection-stringwith your actual connection string and/path/to/dumpwith the path where you want to save the dump files.
Step 2: Import the Dump into Your Local MongoDB Instance
Next, you need to import the BSON files into your local MongoDB instance.
-
Import the Database: Use
mongorestoreto import the BSON files into your local MongoDB.mongorestore --db studycompass --drop /path/to/dump/studycompassnoteFor the mongorestore path, just take your dump path and add
studycompassat the end. For example, if my dump path wasC:\Users\James\dump, the monogrestore path would beC:\Users\James\dump\studycompassReplace
your-local-db-namewith the name you want for your local database,/path/to/dumpwith the path to the dump files, andyour-atlas-db-namewith the name of the database from MongoDB Atlas.