无法在窗口系统上的流星中设置mongodb路径 [英] Unable to set mongodb path in meteor on window system
问题描述
我整天用Google搜索,但是没有找到任何更改流星窗口系统默认数据库的解决方案.所有发现如下
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
给出窗口系统错误-
'MONGO_URL'不被识别为内部或外部命令,
'MONGO_URL' is not recognized as an internal or external command,
将settings.json用作
Used settings.json as
{
"MONGO_URL":"mongodb://127.0.0.1:27018/meteor"
}
然后是流星--settings ./settings.json
,但它仍然不选择此mongo设置.终于在我的js文件中
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.
推荐答案
如果我没记错的话,流星设置仅用于部署.
If I am not mistaken Meteor settings are used only for deployment.
要在开发过程中在Windows上使用不同于本地Windows的另一个MongoDB,可以在Meteor应用程序文件夹中创建一个包含以下命令的批处理文件(* .bat):
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
(考虑到您的MongoDB服务器正在默认设置localhost:27017上监听)
(Considering that your MongoDB server is listening on localhost:27017 which are the default settings)
这篇关于无法在窗口系统上的流星中设置mongodb路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!