Changing the default mongodb database of a Meteor application

Asked

Viewed 178 times

1

Hello, I’m starting to work with the Meteor and I am having difficulties to define where the database will be located along with the authenticated access user. Looking on the internet, I found some references that say I should start the application using this command (as in this question):

"MONGO_URL=mongodb://127.0.0.1:27017/mydb meteor run"

The problem is, even using the possible solutions given in the question I have not yet succeeded in getting Meteor to access a database other than the one that it creates and also use a user access to the database.

Does anyone have any reference to how I can actually alter the Meteor database?

1 answer

1


As I answered another question from you, just customize your file package.json, creating a key "scripts" and putting the data of your database as you prefer. You can create scripts for different databases such as:

{
  "scripts": {
    "development": "MONGO_URL=mongodb://localhost:27017/devdb meteor run",
    "testing": "MONGO_URL=mongodb://localhost:27017/testdb meteor run",
  }
}

Then you can run in development:

$ meteor npm run development

And to run in the test environment:

$ meteor npm run testing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.