CNode

使用connect-mongodb后报警告Please ensure that you set…… setting

问答
Ggiscafer发布于11 年前最后回复11 年前5 回复5085 浏览0 收藏

= 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)

H
hezedu#1·11 年前

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

G
giscafer#2·11 年前
引用 hezeduconnect mongodb 是express存session的中间件...

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

H
hezedu#3·11 年前
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'
    })
}));

H
hezedu#4·11 年前

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

参与回复
登录后即可参与回复。登录