【发布时间】:2013-07-23 17:30:26
【问题描述】:
我已经通过 npm 安装了 sails-mongo 并运行了一个基本的 sails.js 应用程序 但它无法识别我的主机。
MongoDB 已启动并在默认端口 27017 上运行,但在生成模型后,尝试运行应用程序时出现此错误:
这是我的 adapter.js,我正在运行 node v0.10.0 和sails v0.8.895
// Configure installed adapters
// If you define an attribute in your model definition,
// it will override anything from this global config.
module.exports.adapters = {
// If you leave the adapter config unspecified
// in a model definition, 'default' will be used.
'default': 'mongo',
// In-memory adapter for DEVELOPMENT ONLY
// (data is NOT preserved when the server shuts down)
memory: {
module: 'sails-dirty',
inMemory: true
},
// Persistent adapter for DEVELOPMENT ONLY
// (data IS preserved when the server shuts down)
// PLEASE NOTE: disk adapter not compatible with node v0.10.0 currently
// because of limitations in node-dirty
// See https://github.com/felixge/node-dirty/issues/34
// disk: {
// module: 'sails-dirty',
// filePath: './.tmp/dirty.db',
// inMemory: false
// },
mongo: {
module : 'sails-mongo',
url : 'mongodb://Chris:DBPASSWORD@localhost:27017/localHostTestDB'
}
};
我已经将用户添加到 localHostTestDB,角色为 admin。
任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: javascript mongodb sails.js