使用connect-mongodb后报警告Please ensure that you set…… setting
发布于 5天前 作者 giscafer 207 次浏览 来自 问答

= Please ensure that you set the default write concern for the database by setting = = one of the options = = = = w: (value of > -1 or the string ‘majority’), where < 1 means = = no write acknowledgement = = journal: true/false, wait for flush to journal before acknowledgement = = fsync: true/false, wait for flush to file system before acknowledgemen t = = = = For backward compatibility safe is still supported and = = allows values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:t rue}] = = the default value is false which means the driver receives does not = = return the information of the success/error of the insert/update/remove = = = = ex: new Db(new Server('localhost’, 27017), {safe:false}) = = = = http://www.mongodb.org/display/DOCS/getLastError+Command = = = = The default of no acknowledgement will change in the very near future = = = = This message will disappear when the default safe is set on the driver Db = ============================================================================ ============ Sat, 27 Jun 2015 12:49:12 GMT express-session deprecated undefined resave option ; provide resave option at app.js:20:9 Sat, 27 Jun 2015 12:49:12 GMT express-session deprecated undefined saveUninitial ized option; provide saveUninitialized option at app.js:20:9 moviesite started on port 3000

这个怎么解决。
我连接数据库是这么连接的
var dbUrl='mongodb://localhost:27017/test';
mongoose.connect(dbUrl)

网上查询了什么安全连接 module.exports = new Db(settings.db, new Server(settings.host, Connection.DEFAULT_PORT, {safe:true}),{safe:true}); 这个怎么使用。

5 回复

connect-mongodb 是express存session的中间件…

@hezedu 我问的是警告信息怎么解决

var session = require('express-session');
var MongoStore=require('connect-mongodb');
app.use(session({
    name: 'session.id',
    cookie: { 
        path: '/',
        httpOnly: true
        //,maxAge: 1000 * 60 * 60 * 24 * 30 * 12
    },
    store: new MongoStore({
        url:'mongodb://localhost:27017/test'
    })
}));

另connect-mongodb好久不更了.用得人很少了. 楼主可以参考我fork的自动销毁版本: https://github.com/hezedu/connect-mongodb-autoDestroy

@hezedu 谢谢,不更新,那现在都用connect-mongo吗

回到顶部