在Node.js中使用MongoDB模块,报错
Error: Cannot find module '../build/Release/bson'...
解决方案:
首先安装bson模块,npm install bson
然后将根目录下node_modules/mongodb/node_modules/bson/ext/index.js文件中(15行)
bson = require('../build/Release/bson')改为bson = require('bson')即可
当使用express-session启动警告deprecated undefined resave option...
解决方案:
配置resave和saveUninitialized参数
使用connect-mongo模块时,报错
Error setting TTL index on collection : sessions
解决方案:
可能是由于旧的模块版本问题,配置
"connect-mongo" : "0.8.2"
"mongodb" : "2.0.42"
使用mongodb模块时报错
db object already connecting, open cannot be called multiple times...
解决方案:
可能是由于多次连接数据库,忘记关闭上一次的连接了
mongodb.close()