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 ...
随机推荐
- Android 自己的自动化测试(2)依据ID查找对象(java)
前一篇文章是写 Android 自己的自动化测试(1)如何安装和卸载应用程序(java) ,以下再探索一下假设在普通java应用程序中,依据ID来查找对象 1.类库依赖: The library de ...
- Android调试优化篇
为了开发出商业级的应用程序,大规模的測试是不可避免的,同一时候为了提高应用程序的执行速度,须要进行必要的优化.在Android中.提供了丰富的调试与优化工具供开发者应用,主要包含模拟器和目标端等两种场 ...
- (算法入门经典大赛 优先级队列)LA 3135(之前K说明)
A data stream is a real-time, continuous, ordered sequence of items. Some examples include sensor da ...
- 第1周 SQL Server 如何执行一个查询
原文:第1周 SQL Server 如何执行一个查询 大家好,欢迎来到第1周的SQL Server性能调优培训.在我们进入SQL Server性能调优里枯燥难懂的细节内容之前,我想通过讲解SQL Se ...
- opencv环境的搭建,并打开一个本地PC摄像头。
1.opencv环境结构 推荐连结 http://www.cnblogs.com/Anykong/archive/2011/04/06/Anykong_OpenCV1.html 2.以下是基本測试,和 ...
- cocos2d-x适配多分辨率
现在用的2d-x版本是2.1.1.现在的项目要求是iphone ,iphone Retina,ipad和ipad Retina都有各自的路径来存放各自需要的资源.在AppDelegate的 appli ...
- 设单链表中存放n个字符,试设计一个算法,使用栈推断该字符串是否中心对称
转载请注明出处:http://blog.csdn.net/u012860063 问题:设单链表中存放n个字符.试设计一个算法,使用栈推断该字符串是否中心对称,如xyzzyx即为中心对称字符串. 代码例 ...
- android学习经常使用的数据文件夹
android工程实践 1.仿360一键清理实现(一) "一键清理"是一个桌面图标,点击图标后,显示一个视图.进行清理动画.之后显示清理了几个进程,释放了多少M内存.点击" ...
- [LeetCode203]Remove Linked List Elements
题目: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 ...
- unity调用安卓打包apk时的错误unable to convert classes into dex format
出现这种问题一般是由于有重复的文件所致,看下unity报的错误那些文件重复了,把重复的文件删了即可 例如,将eclipse中的安卓工程bin\class导出jar包时,会将下面的.class文件打包, ...