From 61368461263520d4ccb2842ed30ae138bc797773 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 25 Jun 2024 13:50:26 -0400 Subject: [PATCH] fix(query): remove `count()` and `findOneAndRemove()` from query chaining Fix #14689 --- lib/query.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/query.js b/lib/query.js index 5bb3ee9a611..c5c539f63be 100644 --- a/lib/query.js +++ b/lib/query.js @@ -153,6 +153,12 @@ function Query(conditions, options, model, collection) { Query.prototype = new mquery(); Query.prototype.constructor = Query; + +// Remove some legacy methods that we removed in Mongoose 8, but +// are still in mquery 5. +Query.prototype.count = undefined; +Query.prototype.findOneAndRemove = undefined; + Query.base = mquery.prototype; /*!