-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow to estimate document count. #3951
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
Conversation
360c223
to
925cdda
Compare
925cdda
to
002bda7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first review pass and left a few comments up for discussion. The comments apply also to the reactive bits.
...ata-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java
Outdated
Show resolved
Hide resolved
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
Outdated
Show resolved
Hide resolved
* @param entityClass class that determines the collection to use. Must not be {@literal null}. | ||
* @return the count of matching documents. | ||
*/ | ||
Mono<Long> count(Query query, Class<?> entityClass); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We should probably slim down the second documentation paragraph and link to both count methods via @see
.
This commit introduce an option that allows users to opt in on using estimatedDocumentCount instead of countDocuments in case the used filter query is empty. To still be able to retrieve the precise number of matching documents we also introduced MongoTemplate#preciseCount.
002bda7
to
cee670f
Compare
This commit introduce an option that allows users to opt in on using estimatedDocumentCount instead of countDocuments in case the used filter query is empty. To still be able to retrieve the exact number of matching documents we also introduced MongoTemplate#exactCount. Closes: #3522 Original pull request: #3951.
This commit introduce an option that allows users to opt in on using estimatedDocumentCount instead of countDocuments in case the used filter query is empty. To still be able to retrieve the exact number of matching documents we also introduced MongoTemplate#exactCount. Closes: #3522 Original pull request: #3951.
Introduce an option that allows users to opt in on using
estimatedDocumentCount
instead ofcountDocuments
in case the used filter query is empty.