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
Modifier and TypeMethodDescriptionstatic LowerBoundSearchCount
Returns aSearchCount
that instructs to count documents exactly only up to a threshold.static SearchCount
Creates aSearchCount
from aBson
in situations when there is no builder method that better satisfies your needs.static TotalSearchCount
total()
Returns aSearchCount
that instructs to count documents exactly.Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
total
Returns aSearchCount
that instructs to count documents exactly.- Returns:
- The requested
SearchCount
.
-
lowerBound
Returns aSearchCount
that instructs to count documents exactly only up to a threshold.- Returns:
- The requested
SearchCount
.
-
of
Creates aSearchCount
from aBson
in 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 equivalentSearchCount
s, though they may not be equal.SearchCount count1 = SearchCount.lowerBound(); SearchCount count2 = SearchCount.of(new Document("type", "lowerBound"));
- Parameters:
count
- ABson
representing the requiredSearchCount
.- Returns:
- The requested
SearchCount
.
-