node.js开发错误——DeprecationWarning: Mongoose: mpromise
来源:互联网 发布:星际淘宝主微盘 编辑:程序博客网 时间:2024/05/23 07:22
使用mongoose进行数据库操作时,总是提示:
(node:5684) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
解决方法:
在
之前加一句:最后:
这样就好了。
http://mongoosejs.com/docs/promises.html
Plugging in your own Promises Library
New in Mongoose 4.1.0
While mpromise is sufficient for basic use cases, advanced users may want to plug in their favorite ES6-style promises library like bluebird, or just use native ES6 promises. Just set mongoose.Promise
to your favorite ES6-style promise constructor and mongoose will use it.
Mongoose tests with ES6 native promises, bluebird, and q. Any promise library that exports an ES6-style promise constructor should work in theory, but theory often differs from practice. If you find a bug, open an issue on GitHub
var query = Band.findOne({name: "Guns N' Roses"}); // Use native promises mongoose.Promise = global.Promise; assert.equal(query.exec().constructor, global.Promise); // Use bluebird mongoose.Promise = require('bluebird'); assert.equal(query.exec().constructor, require('bluebird')); // Use q. Note that you **must** use `require('q').Promise`. mongoose.Promise = require('q').Promise; assert.ok(query.exec() instanceof require('q').makePromise);
- node.js开发错误——DeprecationWarning: Mongoose: mpromise
- node.js开发错误——DeprecationWarning: Mongoose: mpromise
- mongoose mpromise被废弃警告,(node:3341) DeprecationWarning: Mongoose: mpromise (mongoose's default promis
- mongoose mpromise被废弃警告,(node:3341) DeprecationWarning: Mongoose: mpromise (mongoose's default promis
- Node.js开发——Express+Mongoose
- DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in y
- Node.js开发入门——MongoDB与Mongoose
- Node.js开发入门——MongoDB与Mongoose
- Node.js开发入门——MongoDB与Mongoose
- Node.js开发入门——MongoDB与Mongoose
- node开发之mongoose连接错误
- Node.js开发入门(十一)——MongoDB与Mongoose
- Node.js —— mongoose的population关联
- Node.js —— 使用 Mongoose 模块操作 MongoDB
- mongoose 连接警告问题(node:148572) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0
- node.js mongoose 插件
- node.js开发之express4.0使用mongoose连接mongodb
- node.js开发之使用mongoose实现简单的CRUD
- 争当巡视反馈热烈欢呼第一人
- java nio(一)--Buffer基础
- linux延时函数
- python27在windows环境安装talib的方法
- xcode 插件开发
- node.js开发错误——DeprecationWarning: Mongoose: mpromise
- Appium之安装Carthage
- 腾讯实习内推
- 编译wireshark
- 升级Tensorflow到1.2版本
- 你的爬虫会送老板进监狱吗?
- 从Swift深入理解函数派发机制
- Spring Data JPA概述
- 毕业面试 | 如何准确一分钟介绍你自己?