SailsJS不会加载数据库配置

时间:2014-03-22 13:44:36

标签: node.js mongodb sails.js

这是我的config/adapters.js文件:

module.exports.adapters = {
  mongo: {
    module: 'sails-mongo',
    host: 'localhost',
    port: 27017,
    user: 'root',
    password: 'testing1234',
    database: 'sailstest'
  }
};

这是模型的配置:

module.exports = {
  adapter: 'mongo',
  attributes: {
    username: 'STRING',
    password: 'STRING',
    firstName: 'STRING',
    lastName: 'STRING'
  }

};

当我尝试运行sails lift时,我收到以下错误:

/Users/mike/Dropbox/mongodb/sails-test/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/db.js:216
  if(typeof databaseName !== 'string') throw new Error("database name must be 

      ^
Error: database name must be a string
    at validateDatabaseName (/Users/mike/Dropbox/mongodb/sails-test/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/db.js:216:46)
    at new Db (/Users/mike/Dropbox/mongodb/sails-test/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/db.js:96:3)
    at createConnection (/Users/mike/Dropbox/mongodb/sails-test/node_modules/sails-mongo/lib/adapter.js:497:14)

1 个答案:

答案 0 :(得分:0)

原来是一个未正确报告的身份验证错误。