We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 516f060 commit b7d94c5Copy full SHA for b7d94c5
lib/mongo/Mutator.js
@@ -343,8 +343,14 @@ export default class Mutator {
343
delete removeOptions.projection;
344
}
345
346
- // TODO: optimization check if it has _id or _id with {$in} so we don't have to redo this.
347
- const docs = await this.find(selector, removeOptions).fetchAsync();
+ let docs
+
348
+ if (Object.keys(selector).length === 1 && typeof selector._id === "string") {
349
+ docs = [{ _id: selector._id }];
350
+ } else {
351
+ docs = await this.find(selector, removeOptions).fetchAsync();
352
+ }
353
354
let docIds = docs.map((doc) => doc._id);
355
356
if (!selector._id) {
0 commit comments