Meteor app — resetting a deployed app's DB

MongodbMeteor

Mongodb Problem Overview


Is there a simple way to reset the data from a meteor deployed app?

So, for example, if I had deployed an app named test.meteor.com — how could I easily reset the data that has been collected by that app?

Locally I run meteor reset, but I am unsure of what to do in production.

Mongodb Solutions


Solution 1 - Mongodb

If you have your app with you you could do this in your project directory

meteor deploy test.meteor.com --delete
meteor deploy test.meteor.com 

The first deletes the app so its all blank. The second deploys a fresh instance of it back.

Solution 2 - Mongodb

one way is to login to the mongo instance yourself and delete the relevant data so something like per collection:

$ meteor mongo APP.meteor.com
> db.users.drop()
> db.xxx.drop()

you could just drop the whole DB, but that would confuse their env and you have to --delete the app and re-deploy anyway.

> db.dropDatabase()

Solution 3 - Mongodb

I know this is a bit old, but I just changed my collection name. so in your /lib/collections.js file,

someCollection = new Mongo.Collection("originalcollection");

becomes

someCollection = new Mongo.Collection("newcollectionname");

this is assuming of course that your app generates the data for the database.

Solution 4 - Mongodb

Simply you can access your meteor DB as

> production-db-d2.meteor.io:27017/XYZ_meteor_com > > where XYZ = your subdomain

for authentication use meteor auth (username & password)

You can access it from rockmongo, robomogo, mongoui, etc tools.

To access from command line

First authenticate by typing username, password of meteor

> $ meteor login

Then

> $ meteor mongo XYZ.meteor.com

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCaptConradoView Question on Stackoverflow
Solution 1 - MongodbTarangView Answer on Stackoverflow
Solution 2 - MongodbdcsanView Answer on Stackoverflow
Solution 3 - MongodbDaveView Answer on Stackoverflow
Solution 4 - MongodbNishchitView Answer on Stackoverflow