操作数据库的时候,老是提示: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.con…
原文地址 使用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 解决方法: 在var db = mongoose.connect("…
参考:mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead mongoose报错:(node:9716)DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead 解决方法: // 导入第三方模块mongoose const mongoose = requ…
promise特点 一个promise的当前状态只能是pending.fulfilled和rejected三种之一.状态改变只能是pending到fulfilled或者pending到rejected.状态改变不可逆. 支持链式调用. (1) 原型方法 Promise.prototype.then = function() {} Promise.prototype.catch = function() {} (2) 静态方法 Promise.resolve = function() {} Pro…
Promise是前端面试中的高频问题,我作为面试官的时候,问Promise的概率超过90%,据我所知,大多数公司,都会问一些关于Promise的问题.如果你能根据PromiseA+的规范,写出符合规范的源码,那么我想,对于面试中的Promise相关的问题,都能够给出比较完美的答案. 我的建议是,对照规范多写几次实现,也许第一遍的时候,是改了多次,才能通过测试,那么需要反复的写,我已经将Promise的源码实现写了不下七遍. Promise的源码实现 /** * 1. new Promise时,需…
root@hett-PowerEdge-T30:/usr/local/src/nginx-1.9.8# ./configure --prefix=/usr/local/nginx  --add-module=/usr/local/src/nginx-rtmp-module  --with-htchecking for OS + Linux 4.4.0-116-generic x86_64checking for C compiler ... found + using GNU C compile…
1.Promise的基本使用 // 需求分析: 封装一个方法用于读取文件路径,返回文件内容 const fs = require('fs'); const path = require('path'); /** * 把一个回调函数才分成两个回调函数 * @param filename * @param successCallback * @param errorCallback */ function getFileByPath(filename, successCallback, errorC…
1. let a = new Promise((resolve,reject)=>{ return 23 }) a; // promise <pending> 2. let a = new Promise((resolve,reject)=>{ Promise.reject(234) }) a; // promise <pending> 3. let a = new Promise((resolve,reject)=>{ return Promise.reject…
VS2010正式版不再有单独的MSDN Library安装选项,VS2010的ISO安装光盘里已经包含有MSDN Library,只不过要手动安装,方法如下: 1.安装完VS2010后,在开始菜单中打开Microsoft Visual Studio 2010 - Visual Studio Tools – Manage Help Settings(管理帮助设置),第一次打开时会让你选择一个路径用于保存MSDN Library的内容,建议选择一个剩余空间比较大的盘2.点击“Choose onlin…