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

建议将 coll.count 改为 coll.countDocument #920

Open
cn-ryh opened this issue Dec 15, 2024 · 3 comments
Open

建议将 coll.count 改为 coll.countDocument #920

cn-ryh opened this issue Dec 15, 2024 · 3 comments

Comments

@cn-ryh
Copy link

cn-ryh commented Dec 15, 2024

根据 mongodb 类型声明文件,由于 无法统计准确计数count 方法已经弃用,建议同步更新为 countDocument

NOTE: This method has been deprecated, since it does not provide an accurate count of the documents

@undefined-moe
Copy link
Member

countDocument 会遍历所有符合条件的文档,在统计表内行数时会产生严重的性能问题。

@cn-ryh
Copy link
Author

cn-ryh commented Dec 20, 2024

countDocument 会遍历所有符合条件的文档,在统计表内行数时会产生严重的性能问题。

另有 estimatedDocumentCount 方法可供使用

@undefined-moe
Copy link
Member

我们欢迎您提出 Pull Request。

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