nodejs使用connect-mongodb报错(Please ensure that you set the default write concern)
原本是使用connect-mongo的,可能是express版本号的升级报错了。改用connect-mongodb。可是使用后出现了例如以下的警告:
G:\nodejs\moviesite>grunt
Running "concurrent:tasks" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.3.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
============================================================================
============
= 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
下边的警告在session中加入两个属性值restart和saveUninitialized就可以解决。
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
如:
app.use(session({
resave: false,//又一次保存:强制会话保存即使是未改动的。
(默认值ture)
saveUninitialized: true,//强制保存未初始化的会话到存储器
cookie: {maxAge:3600000},
secret:'imooc',
store:new mongoStore({
url:dbUrl,
collection:'sessions'
})
}))
剩下的警告应该是数据库不是安全连接,还未能解决,知道的朋友告诉一下
nodejs使用connect-mongodb报错(Please ensure that you set the default write concern)的更多相关文章
- ubuntu mongodb报错:mongo - couldn't connect to server 127.0.0.1:27017
在进入mongo的时候,出现在下面错误信息.那如何解决呢? 标记一下,以便下次理碰的到时候,有个参考. warning: Failed to connect to 127.0.0.1:27017, r ...
- mongoDB报错Cannot find module '../build/Release/bson'
打算用nodejs写一个blog系统,发现nodejs还是存在很多的坑.在使用mongodb时遇到如下报错问题: { [Error: Cannot find module '../build/Rele ...
- springboot+mongodb报错Caused by: java.net.ConnectException: Connection refused (Connection refused)
com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.SocketStrea ...
- 启动mongodb报错,无法连接mongodb
报错原因如下: MongoDB shell version v3.4.2 connecting to: mongodb://127.0.0.1:27017 --01T12:: W NETWORK [t ...
- sudo brew install mongodb报错
报错信息如下: Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew ...
- 有关Gradle Network is unreachable: connect的报错
项目Gradle Errer:Network is unreachable: connect 同时还有as的 报错 Internal HTTP server disabled: Cannot st ...
- mongodb报错一例
开发程序报错信息: Caused by: com.mongodb.MongoException: Executor error: OperationFailed: Sort operation use ...
- mongodb报错:connection refused because too many open connections: 819
问题: 发现mongodb无法连接,查看mongodb日志,出现大量的如下报错: [initandlisten] connection refused because too many open co ...
- Kettle6.1连接MongoDB报错
配置好mongodb连接之后,点击预览报下面的错: 报错: java.lang.NoClassDefFoundError: javax/crypto/spec/PBEKeySpec a ...
随机推荐
- mysql寻呼最快
大家都知道,mysql分页写: select * from 'yourtable' limit start,rows 如今我数据库一张表里面有9969W条数据.表名叫tweet_data select ...
- spring 重定向以及转发 乱码问题解决
1.spring 转发 request.setAttribute("id", id); request.setAttribute("name",name); r ...
- [PATCH] UBUNTU: SAUCE: (no-up) apparmor: Sync to apparmor3 - RC1(v3.4.x kernel)
ubuntu touch v3.4 kernel AppArmor v3 backport patch 地址1:https://github.com/multirom-aries/ubuntu-pho ...
- 【深入浅出jQuery】源码浅析--整体架构(转)
最近一直在研读 jQuery 源码,初看源码一头雾水毫无头绪,真正静下心来细看写的真是精妙,让你感叹代码之美. 其结构明晰,高内聚.低耦合,兼具优秀的性能与便利的扩展性,在浏览器的兼容性(功能缺陷.渐 ...
- mysql多实例的配置(转)
1.创建多实例的目录: mkdir -p /data/mysql/mysql_3307/{data,tmp,logs} mkdir -p /data/mysql/mysql_3308/{data,tm ...
- 玩转web之json(五)---将表单通过serialize()方法获取的值转成json
form表单有一个serialize()方法,可以序列化表单的值,但是jquery提供的这个方法会把数据序列化为类似下面的形式: a=1&b=2&c=3&d=4 jquery并 ...
- 【剑指offer】打印单列表从尾部到头部
转载请注明出处:http://blog.csdn.net/ns_code/article/details/25028525 剑指offer上的第五题,在九度OJ上測试通过. 时间限制:1 秒 内存限制 ...
- mysqldump 命令的使用
1.导出结构不导出数据 mysqldump -d databasename -uroot -p > xxx.sql 2.导出数据不导出结构 mysqldump -t databasename - ...
- javascript 的bind/apply/call性能
javascript有两种使用频率非常高的三个内置的功能:bind/apply/call.许多技术是基于高点,这些功能实现.这三个功能被用来改变的功能运行环境.从而达到代码复用的目的. 先来所说bin ...
- LCA 学习算法 (最近的共同祖先)poj 1330
Nearest Common Ancestors Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20983 Accept ...