操作数据库的时候,老是提示: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. 集训Day11

    别人的题公开原题面不好 写题解吧 T1 很明显答案满足二分,二分之后算出每个人的位置,做一个LIS即可 T2 阅读体验极差 T3 根本不会 交都没交 期望得分200

  2. Qt图形视图体系结构

    导读:本文主要翻译自QT 5.9.3GraphicsView官方文档 一.GraphicsView框架简介 QT4.2开始引入了Graphics View框架用来取代QT3中的Canvas模块,并作出 ...

  3. 洛谷P1020导弹拦截——LIS

    题目:https://www.luogu.org/problemnew/show/P1020 主要是第二问,使用了dilworth定理:一个序列中最长不上升子序列的最大覆盖=最长上升子序列长度. di ...

  4. mysql建表练习

    create table class( cid int primary key auto_increment, caption ) not null )engine=innodb; create ta ...

  5. AR/VR-VR:VR

    ylbtech-AR/VR-VR:VR 虚拟现实技术是一种可以创建和体验虚拟世界的计算机仿真系统,它利用计算机生成一种模拟环境,是一种多源信息融合的.交互式的三维动态视景和实体行为的系统仿真使用户沉浸 ...

  6. python3+selenium使用浏览器IE的时候,无法打开IE浏览器,老是报错: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones

    python3+selenium使用浏览器IE的时候,老是报错: Unexpected error launching Internet Explorer. Protected Mode settin ...

  7. 第一章 Git 一览

    虽然这个系列的文章主要关注的是Github,然而首先了解下Git的基本概念和名词也是非常有帮助的. 工作目录(Working Directory) 工作目录是你个人计算机上的一个目录.在该目录下,每一 ...

  8. 搭建Node+NPM+Grunt+Ruby开发环境

    序 最近尝试了一下CoffeeScript,和Sass,不得不说这两个搭配起来的确是不错的选择,熟悉以后基本上开发就比较快速了. 当然要开发这个首先需要搭建环境,这里就需要有Node.NPM.Grun ...

  9. AngularJs(Part 4)--Modules depending on other Modules

    Angular does an excellent job of managing object dependencies. it can even take care of module depen ...

  10. java&nbsp;原始类与封装类&nbsp;的区别

    int是java提供的8种原始数据类型之一.Java为每个原始类型提供了封装类,Integer是java为int提供的封装类.int的默认值为0,而Integer的默认值为null,即Integer可 ...