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 ...
随机推荐
- 王立平--include在Android应用
它包括一个布局和布局 1.在layout确定activity_other.xml布局 2.代码中的包括例如以下: <LinearLayout xmlns:android="http:/ ...
- 使用JAVASCRIPT实现静态物体、静态方法和静态属性
Javascript语言的面向对象特征非常弱.其它面向对象语言在创建类时仅仅要使用keywordstatic就可以指定类为静态类,Javascript没有提供static这种keyword.要让Jav ...
- leetcode先刷_Remove Duplicates from Sorted List II
删除重复节点列表中的.假设所有val如果仅仅是为了保持一个非常easy.应承担重复val节点被删除话.要保持pre节点.每当你想保存这pre问题节点,应该head节点可以被取出,好了,没问题边境控制. ...
- Apache Rewrite 理解
因为工作须要,查了一下Apache的文档,对当中反向引用和条件的运行做了理解和实验,以下是对Apache 2.2文档的摘录,并在上面做了实验的样例说明,希望能给一些须要深入理解的一些帮助. 其它部分就 ...
- js+html+css简单的互动功能页面(2015知道几乎尖笔试题)http://v.youku.com/v_show/id_XMTI0ODQ5NTAyOA==.html?from=y1.7-1.2
js+html+css实现简单页面交互功能(2015知乎前端笔试题) http://v.youku.com/v_show/id_XMTI0ODQ5NTAyOA==.html? from=y1.7-1. ...
- oralce 获取自定义主键编码,有并发问题
F_GET_SEQUENCE,功能函数,当多个服务同时调用此函数,可能产生并发问题,待解决,加主键. CREATE OR REPLACE Function f_Get_Sequence(As_Comp ...
- sql 与linq的转换
1. left Join 原始sql select t.[MINTAccountIdentifier] from BSS_Tenant t left join BL_SAPCustomer s on ...
- HTML5实际和离线应用分析
当前离线Web申请书,即,该装置不能访问因特网时的应用的执行.HTML5离线应用重点,主要开发人员希望.步骤离线应用开发有:首先我们应该知道设备是否可以连接;然后,它也应该可以访问某些资源(像.CSS ...
- 【JUnit4.10来源分析】6 Runner
org.junit.runner.Runner它是JUnit作业引擎.它在许多类型的支持下的.处理试验和生产(Description).Failure和Result和其它输出. Runner参见图主类 ...
- Codeforces Round #270(利用prim算法)
D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 mega ...