Hi, Currently we have mongodb v5.8 package installed. While upgrading to v6.5.0, i’ve encountered few typescript types issue for the package mongodb@6.5.0.
The objective is to get return type as ModifyResult.
So, below is the types specified for findOneAndUpdate methods:
And i’ve my configs like below:
const options = {
includeResultMetadata: true
}
db.collection(collectionName).findOneAndUpdate(conditions, options)
While i do this, I’m getting a return type of WithId, even after specifying includeResultMetadata to true in the options.
Whereas, if i do like below, I’m getting the return type as ModifyResult which was our intention
db.collection(collectionName).findOneAndUpdate(conditions, options && { includeResultMetadata: true })
So, my question is, do we really need to add includeResultMetadata seperately inorder to get the return type as ModifyResult ??
