在配置文件中的代码如下:
未处理的拒绝MongoError:无法连接到服务器 at Collection.listIndexes (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/collection.js:1750:11) at indexInformation (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/db.js:1625:25) at Db.indexInformation (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/db.js:1589:44) at ensureIndex (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/db.js:1082:8) at Db.ensureIndex (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/db.js:1058:44) at ensureIndex (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/collection.js:1820:13) at Collection.ensureIndex (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/mongodb/lib/collection.js:1808:44) at MongoStore.setAutoRemoveAsync (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/connect-mongo/src/index.js:123:40) at MongoStore.handleNewConnectionAsync (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/connect-mongo/src/index.js:116:18) at MongoStore (/home/shaishab/Project/Open-Source/BS-Commerce/node_modules/connect-mongo/src/index.js:95:26) at module.exports (/home/shaishab/Project/Open-Source/BS-Commerce/config/express.js:101:10) at Object. (/home/shaishab/Project/Open-Source/BS-Commerce/server.js:31:38) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10)
var session = require('express-session'),
MongoStore = require('connect-mongo')(session),
mongoose = require('mongoose');
var db = mongoose.connect('dbUrl');
app.use(session({
saveUninitialized: true,
resave: true,
secret: config.sessionSecret,
store: new MongoStore({
db: db.connection.db,
collection: config.sessionCollection
})
}));
有人能帮我吗?
(涉及IT技术,具体问题未知)