Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@types/mongodb] collection.estimatedDocumentCount signature is invalid #49601

Closed
4 tasks done
gempain opened this issue Nov 16, 2020 · 1 comment
Closed
4 tasks done

Comments

@gempain
Copy link

gempain commented Nov 16, 2020

The official docs mention that:

db.collection.estimatedDocumentCount() does not take a query filter and instead uses metadata to return the count for a collection.

Correct me if I'm wrong, but I think the signature should only take the options. Using query filters with this method will lead to incorrect results:

await collection.insertOne({
  name: 'foo',
  children: [
    { name: 'bar' },
  ],
});

const query = {
  name: 'huh',
};

console.log('estimatedCount', await collection.estimatedDocumentCount(query));
console.log('count', await collection.countDocuments(query));

will print

estimatedCount 1
count 0
@orta orta closed this as completed Jun 7, 2021
@orta
Copy link
Collaborator

orta commented Jun 7, 2021

Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the @types modules in DefinitelyTyped.

To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the definitely-typed channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants