大佬教程收集整理的这篇文章主要介绍了node.js – (node:3341)DeprecationWarning:Mongoose:mpromise,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到这个警告
(node:3341) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated,plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
后我做
driver.createCar({ carName: 'jeep',availableSeats: 4,},callBACk);
driver是Driver类的一个实例
const carscheR_823_11845@a = new scheR_823_11845@a({ carName: String,availableSeats: number,createdOn: { type: Date,default: Date.Now },}); const driverscheR_823_11845@a = new scheR_823_11845@a({ email: String,name: String,city: String,phonenumber: String,cars: [carscheR_823_11845@a],userId: { type: scheR_823_11845@a.Types.ObjectId,required: true,}); const DriverModel = mongoose.model('Driver',driverscheR_823_11845@a); class Driver extends DriverModel { getCurrentDate() { return moment().format(); } create(cb) { // save driver this.createdOn = this.getCurrentDate(); this.save(cb); } remove(cb) { super.remove({ _id: this._id,cb); } createCar(carData,cb) { this.cars.push(carData); this.save(cb); } getCars() { return this.cars; } }
任何想法,我做错了什么?
以上是大佬教程为你收集整理的node.js – (node:3341)DeprecationWarning:Mongoose:mpromise全部内容,希望文章能够帮你解决node.js – (node:3341)DeprecationWarning:Mongoose:mpromise所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。