diff --git a/src/collection.ts b/src/collection.ts index e22ce9eeca..e3a5f43a95 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -99,7 +99,12 @@ import { } from './utils'; import { WriteConcern, WriteConcernOptions } from './write_concern'; -/** @public */ +/** + * @public + * @deprecated This type will be completely removed in 5.0 and findOneAndUpdate, + * findOneAndDelete, and findOneAndReplace will then return the + * actual result document. + */ export interface ModifyResult { value: WithId | null; lastErrorObject?: Document; diff --git a/test/types/community/collection/findX.test-d.ts b/test/types/community/collection/findX.test-d.ts index 463ba1518e..733e1c83d3 100644 --- a/test/types/community/collection/findX.test-d.ts +++ b/test/types/community/collection/findX.test-d.ts @@ -348,3 +348,21 @@ expectType | null>( expectType | null>( (await coll.findOneAndDelete({ a: 3 }, { projection: { _id: 0 } })).value ); + +// NODE-3568: Uncomment when ModifyResult is removed in 5.0 +// expectType | null> | null>((await coll.findOneAndDelete({ a: 3 }))); +// expectType | null>( +// (await coll.findOneAndReplace({ a: 3 }, { a: 5, b: 'new string' })) +// ); +// expectType | null>( +// ( +// await coll.findOneAndUpdate( +// { a: 3 }, +// { +// $set: { +// a: 5 +// } +// } +// ) +// ) +// );