mongodb Meteor 应用程序 — 重置已部署应用程序的数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15583107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 13:07:26  来源:igfitidea点击:

Meteor app — resetting a deployed app's DB

mongodbmeteor

提问by CaptConrado

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?

因此,例如,如果我部署了一个名为test.meteor.com—的应用程序,我如何轻松重置该应用程序收集的数据?

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

我在本地运行meteor reset,但我不确定在生产中要做什么。

回答by Akshat

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.

第一个删除应用程序,使其全部为空白。第二个部署它的一个新实例。

回答by dcsan

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

一种方法是自己登录 mongo 实例并删除相关数据,例如每个集合:

$ 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 --deletethe app and re-deploy anyway.

你可以删除整个数据库,但这会混淆他们的环境,你必须--delete使用应用程序并重新部署。

> db.dropDatabase()

回答by Dave

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

我知道这有点旧,但我只是更改了我的收藏名称。所以在你的/lib/collections.js文件中

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.

这当然是假设您的应用程序为数据库生成数据。

回答by Nishchit Dhanani

Simply you can access your meteor DB as

只需您可以访问您的流星数据库

production-db-d2.meteor.io:27017/XYZ_meteor_com

where XYZ = your subdomain

production-db-d2.meteor.io:27017/XYZ_meteor_com

其中 XYZ = 您的子域

for authentication use meteor auth (username & password)

身份验证使用meteor auth(用户名和密码)

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

您可以从rockmongorobomogomongoui等工具访问它。

To access from command line

从命令行访问

First authenticate by typing username, password of meteor

首先通过输入用户名,meteor的密码进行身份验证

$ meteor login

$流星登录

Then

然后

$ meteor mongo XYZ.meteor.com

$meteor mongo XYZ.meteor.com