Note some of this is from memory months ago in combination with old nots so let me know if updating is needed.
::mongodump:: to backup and maintain all the BSON although not recomended for sharded clusters - see atlas documentation.
mongodump —-uri “mongodb://heroku_xxxxx:PASSWORD@ds261238.mlab.com:61238/heroku_00xzkv83”
note that for mlab the username and the authentication database are the same
::mongorestore:: to restore initial database using a mongodump directory:
mongorestore -—uri=“mongodb+srv://USERNAME:PASSWORD@cluster0-5yogy.mongodb.net/test?authSource=admin” —-db=DBNAME DBDUMP-LOCAL-PATH
uri connection string of username:password@server followed by database to restore into
—-db=database
and then the dump directory / database dumb
Be sure that you have already set up you whitelist ips for the cluster. If on standard Heroku without special addons you'll need to use 0.0.0.0 which means anyone can try to connect to it.
Add database from the Clusters menu item on right after logging into Atlas Setup users and ip whitelist under CONNECT Setup database and collections under COLLECTIONS
I recomend using Mongo's Compass application to ensure that the database setup and reachable before updating the connection string in your app. This just ensures you arent tying to fix things that arent broken inside you spp if there's an issue. Compass