操作数据库的时候,老是提示:Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

增删改都没有问题,但是很影响排错。

解决办法:在连接数据库的时候,添加mongoose.Promise = global.Promise;

mongoose.connect(url, mongoOptions);
mongoose.Promise = global.Promise;
mongoose.connection.on('error', function (err) {
console.log('Mongo Error:' + err);
}).on('open', function () {
console.log('Connection opened');
});

Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html的更多相关文章

  1. node.js开发错误——DeprecationWarning: Mongoose: mpromise

    原文地址 使用mongoose进行数据库操作时,总是提示: (node:5684) DeprecationWarning: Mongoose: mpromise (mongoose's default ...

  2. mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead

    参考:mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead mo ...

  3. Promise原理—一步一步实现一个Promise

    promise特点 一个promise的当前状态只能是pending.fulfilled和rejected三种之一.状态改变只能是pending到fulfilled或者pending到rejected ...

  4. Promise的源码实现(完美符合Promise/A+规范)

    Promise是前端面试中的高频问题,我作为面试官的时候,问Promise的概率超过90%,据我所知,大多数公司,都会问一些关于Promise的问题.如果你能根据PromiseA+的规范,写出符合规范 ...

  5. nginx 编译某个模板的问题./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library stati

    root@hett-PowerEdge-T30:/usr/local/src/nginx-1.9.8# ./configure --prefix=/usr/local/nginx  --add-mod ...

  6. 【JavaScript进阶】深入理解JavaScript中ES6的Promise的作用并实现一个自己的Promise

    1.Promise的基本使用 // 需求分析: 封装一个方法用于读取文件路径,返回文件内容 const fs = require('fs'); const path = require('path') ...

  7. promise不会被return触发, 一个promise对象中不会被Promise.reject触发

    1. let a = new Promise((resolve,reject)=>{ return 23 }) a; // promise <pending> 2. let a = ...

  8. mongoose 报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead

    mongoose.set('useCreateIndex', true)    // 加上这个

  9. MSDN Library for vs 2010安装及使用(MSDN Library)

    VS2010正式版不再有单独的MSDN Library安装选项,VS2010的ISO安装光盘里已经包含有MSDN Library,只不过要手动安装,方法如下: 1.安装完VS2010后,在开始菜单中打 ...

随机推荐

  1. [Poi2011] Meteors(从不知所措到整体二分)

    Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The plan ...

  2. BZOJ_2064_分裂_状压DP

    BZOJ_2064_分裂_状压DP Description 背景: 和久必分,分久必和... 题目描述: 中国历史上上分分和和次数非常多..通读中国历史的WJMZBMR表示毫无压力. 同时经常搞OI的 ...

  3. QT(1)介绍

    Qt官网 Qt官网:https://www.qt.io Qt下载:http://www.qt.io/download Qt所有下载:http://download.qt.io/archive/qt Q ...

  4. MQTT 客户端源码分析

    参看:逍遥子_mosquitto源码分析系列 参看:MQTT libmosquitto源码分析 参看:Mosquitto学习笔记 一.目录结构 首先我们还是来看一下 mosquitto-1.4.14 ...

  5. day5 面向对象

    面向对象的特征 封装(encapsulation) 继承(inheritance) 多态(polymorphism) 开发的过程:其实就是不断的创建对象,使用对象,指挥对象做事情. 设计的过程:其实就 ...

  6. LayUI 子父窗体的交互

    ---恢复内容开始--- 收到的工作是将一个ERP的窗体程序改为网页实现,所以就肯定需要弹框来选择(如:物料编码.部门.业务员等等) 本文采取的前段框架是LayUI. layUI的官网API网址:ht ...

  7. 容易忘记的css属性和动画属性

    动画属性 @keyframes 关键帧 --> animation 活泼 (配合使用) transform 变换 --> transition 过渡 (配合使用) 1.animation ...

  8. unite2017相关

    日程 http://unite2017.csdn.net/ http://www.sohu.com/a/137202360_280780 http://www.gameres.com/750046.h ...

  9. PHP RSA算法 HMAC-SHA1加密算法

    HMAC-SHA1加密算法 function getSignature($str, $key) { $signature = ""; if (function_exists('ha ...

  10. jsp网站访问次数统计

    JSP 点击量统计 有时候我们需要知道某个页面被访问的次数,这时我们就需要在页面上添加页面统计器,页面访问的统计一般在用户第一次载入时累加该页面的访问数上. 要实现一个计数器,您可以利用应用程序隐式对 ...