Unable to set mongodb path in meteor on window system

帅比萌擦擦* 提交于 2019-12-19 10:08:05

问题


I googled for the whole day but did not found any solution to change default database in meteor for window system. All findings are as follows

MONGO_URL=mongodb://127.0.0.1:27018/meteor  meteor 

Gives error on window system -

'MONGO_URL' is not recognized as an internal or external command,

Used settings.json as

{
    "MONGO_URL":"mongodb://127.0.0.1:27018/meteor"
}

and then meteor --settings ./settings.json

but still it does not pick this mongo setting. Finally in my js file

if (Meteor.isServer){     
    process.env.MONGO_URL="mongodb://127.0.0.1:27018/meteor"
}

This also not working. Any suggestion in this regard will be highly appreciated.


回答1:


If I am not mistaken Meteor settings are used only for deployment.

To use another MongoDB than the local one on windows during development, you can create a batch file (*.bat) containing the following commands in your Meteor app folder:

SET MONGO_URL=mongodb://localhost:27017/name_of_the_db
meteor

(Considering that your MongoDB server is listening on localhost:27017 which are the default settings)



来源:https://stackoverflow.com/questions/29824944/unable-to-set-mongodb-path-in-meteor-on-window-system

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!