-
Notifications
You must be signed in to change notification settings - Fork 0
setting up the mongodb
First you are gonna need a mongodb cluster. You can use any mongodb cluster provider. We recommend using MongoDB Atlas. You can also use a self-hosted mongodb cluster. But you are gonna need to set up a mongodb cluster in a server. You can use a VDS or a VPS. You can also use a PaaS like Heroku or Glitch. We will be using MongoDB Atlas to set up our mongodb cluster. But in order to use MongoDB Atlas a valid hosting address is required. Such as 'mongodb.vpatient.com'. Keep that in mind.
After you set up your mongodb cluster, you are gonna need to connect your mongodb cluster to your server. You can use a mongodb connection string to connect your mongodb cluster to your server. You can find your mongodb connection string in your mongodb cluster's dashboard. After getting your mongodb connection string, you are gonna need to set up your mongodb connection string in your API. Just change related variables in '.env' file.
After setting up the mongodb cluster you have to import previous data to your mongodb cluster. You can use the 'vpatient.json' file to import previous data to your mongodb cluster. You have to use 'mongodump' command to import the whole database. You can find more information about 'mongodump' command here.
You can just use the following command to import the whole database in your API directory:
mongodump --uri="mongodb+srv://<username>:<password>@<cluster-address>/<database>?retryWrites=true&w=majority" -d test -o ./backup
You can see previous data after importing the whole database. You can also use MongoDB Compass to see previous data. You can find more information about MongoDB Compass here.
All rights reserved VPatient.