Package com.mongodb.client.model.search
Interface SearchCount
- All Superinterfaces:
Bson
- All Known Subinterfaces:
LowerBoundSearchCount,TotalSearchCount
Counting options.
You may use the
$$SEARCH_META variable, e.g., via Projections.computedSearchMeta(String),
to extract the results of counting.- Since:
- 4.7
- MongoDB Atlas documentation
- Counting
-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic LowerBoundSearchCountReturns aSearchCountthat instructs to count documents exactly only up to a threshold.static SearchCountCreates aSearchCountfrom aBsonin situations when there is no builder method that better satisfies your needs.static TotalSearchCounttotal()Returns aSearchCountthat instructs to count documents exactly.Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
total
Returns aSearchCountthat instructs to count documents exactly.- Returns:
- The requested
SearchCount.
-
lowerBound
Returns aSearchCountthat instructs to count documents exactly only up to a threshold.- Returns:
- The requested
SearchCount.
-
of
Creates aSearchCountfrom aBsonin situations when there is no builder method that better satisfies your needs. This method cannot be used to validate the syntax.Example
The following code creates two functionally equivalentSearchCounts, though they may not be equal.SearchCount count1 = SearchCount.lowerBound(); SearchCount count2 = SearchCount.of(new Document("type", "lowerBound"));- Parameters:
count- ABsonrepresenting the requiredSearchCount.- Returns:
- The requested
SearchCount.
-