Mongo中的光标是否指向相同的结果?
如果我要使用光标参考一些结果,是否有区别,是否要检索文档和文档的总数? (我还使用跳过和限制参数)
在这种情况下,光标是否返回相同数量的文档,用于TotalCount和Docs:
const builtQuery = { ... };
const myCursor = MyCollection.collection.find(builtQuery);
const totalCount = await myCursor.count();
const docs = await myCursor.skip().limit().toArray();
是否在相同的请求中完成了总计和文档?我怎么知道它将返回文档的确切总计?如果请求文档需要更多的时间,而总计数字较小或更大,则Docs编号。
Is there a difference if I use cursor to refer to some results or not if I want to retrieve documents and total count of documents? (I am also using skip and limit params)
Is cursor returning the same number of docs in this case for totalCount and docs:
const builtQuery = { ... };
const myCursor = MyCollection.collection.find(builtQuery);
const totalCount = await myCursor.count();
const docs = await myCursor.skip().limit().toArray();
Is totalCount and docs done in the same request? How can I know that it will return the exact totalCount of the docs? What if requesting docs takes more time and the totalCount number is smaller or bigger that docs number.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论