Using the C API, is there a way to find out the result size of a mongoc_collection_find()? I could not find anything in the documentation that lets me see how big a cursor is.
Is the only way to do a mongoc_collection_count before and then do a find()? Basically having to run the query twice?
It is not possible to know how many documents would match beforehand without actually counting them (either via an index scan or table scan).
Getting a count is much faster than going the query itself though as the data would not need to be retrieved or returned by the database.
댓글 없음:
댓글 쓰기