From 250d160d2dd9046d0b9925c34d4840e05dd01370 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 2 May 2023 09:53:50 -0400 Subject: [PATCH] types(document): correct return type for `Model.prototype.deleteOne()`: promise, not query Fix #13223 --- test/types/document.test.ts | 2 +- types/document.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/types/document.test.ts b/test/types/document.test.ts index c9836501271..f1949c7bea2 100644 --- a/test/types/document.test.ts +++ b/test/types/document.test.ts @@ -39,7 +39,7 @@ const Test = model('Test', schema); void async function main() { const doc = await Test.findOne().orFail(); - expectType>(doc.deleteOne()); + expectType>(doc.deleteOne()); }(); diff --git a/types/document.d.ts b/types/document.d.ts index 7a2934b95ac..efd25dae253 100644 --- a/types/document.d.ts +++ b/types/document.d.ts @@ -107,7 +107,7 @@ declare module 'mongoose' { db: Connection; /** Removes this document from the db. */ - deleteOne(options?: QueryOptions): QueryWithHelpers; + deleteOne(options?: QueryOptions): Promise; /** * Takes a populated field and returns it to its unpopulated state. If called with