Skip to content

Commit dc61a0f

Browse files
committed
fix(NODE-4079): update per comments
1 parent 3969ca7 commit dc61a0f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/collection.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,12 @@ export class Collection<TSchema extends Document = Document> {
10461046
* Gets an estimate of the count of documents in a collection using collection metadata.
10471047
* This will always run a count command on all server versions.
10481048
*
1049+
* due to an oversight in versions 5.0.0-5.0.8 of MongoDB, the count command,
1050+
* which estimatedDocumentCount uses in its implementation, was not included in v1 of
1051+
* the Stable API, and so users of the Stable API with estimatedDocumentCount are
1052+
* recommended to upgrade their server version to 5.0.9+ or set apiStrict: false to avoid
1053+
* encountering errors.
1054+
*
10491055
* @see {@link https://www.mongodb.com/docs/manual/reference/command/count/#behavior|Count: Behavior}
10501056
* @param options - Optional settings for the command
10511057
* @param callback - An optional callback, a Promise will be returned if none is provided

src/operations/estimated_document_count.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class EstimatedDocumentCountOperation extends CommandOperation<number> {
4040
}
4141

4242
super.executeCommand(server, session, cmd, (err, response) => {
43-
if (err && (err as MongoServerError).code !== 26) {
43+
if (err) {
4444
callback(err);
4545
return;
4646
}

0 commit comments

Comments
 (0)