javascript - meteor connection to an other mongodb (not the local one) -
i have launched localhost:207017 mongod 3.0.5 separate mongodb meteor's want connect meteor (which has local mongodb). have seen in how use existing mongodb in meteor project? can use: export mongo_url=mongodb://localhost:27017/your_db link "something" mongo server.
question:
- where mongo_url env variable stored ie locally in meteor appli ? meteor appli dealing or meteor.
- how come local mongodb of appli
- with following code, no collection created in your_db have new collection (empty) called meteor_accounts_loginserviceconfiguration.
in meteor, using todo example meteor doc site
.js file
tasks = new mongo.collection("tasks"); if (meteor.isclient) { // code runs on client template.body.helpers({ tasks: function () { return tasks.find({}); } }); }
.html file
<body> <div class="container"> <header> <h1>todo list</h1> </header> <ul> {{#each tasks}} {{> task}} {{/each}} </ul> </div> </body> <template name="task"> <li>{{text}}</li> </template>
anybody has clew how setup , working , how fix it?
best,
g
environment variables can set on command line launch application, not need set in overall shell environment. doing mean either global shell or global shell sessions depending if set permanently.
but simple migration me few steps:
start meteor application in 1 window
in window connect it's local mongodb running port. ( in case on 3001 ), check:
mongo --port 3001
after reporting connected , exiting shell, run
mongoexport
,mongoimport
copy desired collection:mongoexport --port 3001 -d meteor -c cards | mongoimport -d meteor -c cards
i piping output export import simple. choosing keep same database name, can change if want. repeat exports each collection want.
stop meteor application stops local server, , resart environment setting issued before
meteor
command. again, put everyhting in "meteor" database, connecting to:mongo_url="mongodb://localhost:27017/meteor" meteor
when app started up, hapilly reads data migrated collection , displays perfectly.
for paranoid, if did not notice output in meteor startup did not report local mongodb starting, can check running processes , see "global" mongodb instance running.
or of course if pointed machine, there no mongodb running on application server.
Comments
Post a Comment