Deprecation Warning
See original GitHub issueI’m getting this warning
(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
after I do
driver.createCar({
carName: 'jeep',
availableSeats: 4,
}, callback);
driver is an instance of Driver class
const carSchema = new Schema({
carName: String,
availableSeats: Number,
createdOn: { type: Date, default: Date.now },
});
const driverSchema = new Schema({
email: String,
name: String,
city: String,
phoneNumber: String,
cars: [carSchema],
userId: {
type: Schema.Types.ObjectId,
required: true,
},
createdOn: { type: Date, default: Date.now },
});
const DriverModel = mongoose.model('Driver', driverSchema);
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;
}
}
any thoughts about what Im doing wrong?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:43
- Comments:79 (5 by maintainers)
Top Results From Across the Web
What does DeprecationWarning mean when running Python
removing is danger because user may used that and if a developer want to remove a thing first have to notify others to...
Read more >warnings — Warning control — Python 3.11.1 documentation
DeprecationWarning. Base category for warnings about deprecated features when those warnings are intended for other Python developers (ignored by default, ...
Read more >Dealing with Deprecation Warnings - Java Cookbook [Book]
As a general rule, when something has been deprecated, you should not use it in any new code and, when maintaining code, strive...
Read more >Deprecation warnings in legacy JavaScript code using ...
In software development, deprecation is usually associated with changes in the APIs of libraries and frameworks. Deprecation warnings are ...
Read more >Python deprecation - DEV Community
To let the warning refer to the caller, so you know exactly where you use deprecated code, you have to set stacklevel=2 ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I solved that warning doing
Right before calling mongoose.connect
So stupid issue!