更新时间:2023-12-04 11:09:40
区别在于语法.Find
和 FindAsync
都允许构建具有相同性能的异步查询,只是
The difference is in a syntax.
Find
and FindAsync
both allows to build asynchronous query with the same performance, only
FindAsync
返回 cursor,它不会一次加载所有文档,并为您提供从 DB 游标中一一检索文档的界面.在查询结果很大的情况下很有帮助.
FindAsync
returns cursor which doesn't load all documents at once and provides you interface to retrieve documents one by one from DB cursor. It's helpful in case when query result is huge.
Find
通过方法 ToListAsync
为您提供更简单的语法,其中它从游标中检索文档并一次返回所有文档强>.
Find
provides you more simple syntax through method ToListAsync
where it inside retrieves documents from cursor and returns all documents at once.