0

我已经开始使用 CompoundJS 和 MongoDB 作为数据库。我知道我应该在 中进行主机配置/config/database.json,但不确定如何为数据库配置添加用户名/密码。

我尝试添加如下用户名/密码,但它不起作用

{ "development":
  { "driver":   "mongoose"
  , "url": "mongodb://localhost/stats_development",
    "username": "admin",
    "password": "123456"
  }
, "test":
  { "driver":   "mongoose"
  , "url": "mongodb://localhost/stats_test",
    "username": "admin",
    "password": "123456"
  }
, "production":
  { "driver":   "mongoose"
  , "url": "mongodb://localhost/stats_production",
    "username": "admin",
    "password": "123456"
  }
}
4

1 回答 1

1

我找到了解决方案..

mongodb://user:password@host:port/dbname

感谢 Sagish,参考:https ://github.com/1602/compound/issues/377

于 2013-02-07T08:41:45.063 回答