how to replace this.getQuery() to this.getFilter() in mongoose

Viewed 222
const mongoose = require('mongoose');
const exec = mongoose.Query.prototype.exec;

mongoose.Query.prototype.exec = async function () {
  console.log(this.getQuery());
  console.log(this.getFilter);
}

getting depreciation warning when using getQuery to use getFilter instead
and when using getFilter getting getFilter is not function

1 Answers

Judging from your code i assume you're following the NodeJS: Advanced Concept course. In any case, to be able to reference getFilter() in the exec prototype, make sure that the mongoose version is the latest at the time of this comment (5.11.17).

Related