Skip to content

Commit e942c73

Browse files
committed
Pass includeResultMetadata: true to findOneAndUpdate().
1 parent 332b8b8 commit e942c73

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
### Fixed
66
- Do not pass `writeOptions` in database calls.
77
- Use proper `"returnDocument": "after"` option w/`findOneAndUpdate`.
8+
- Pass `includeResultMetadata: true` to `findOneAndUpdate` to ensure meta data
9+
is always returned.
810

911
## 22.1.1 - 2025-03-04
1012

lib/documents.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ export async function _refresh({
637637
query, update, {
638638
projection,
639639
returnDocument: 'after',
640-
promoteBuffers: true
640+
promoteBuffers: true,
641+
includeResultMetadata: true
641642
});
642643
// return whether update occurred and new record if it did
643644
return {updated: result.lastErrorObject.n !== 0, record: result.value};

0 commit comments

Comments
 (0)