Package com.mongodb.client.model
Class CountOptions
- java.lang.Object
-
- com.mongodb.client.model.CountOptions
-
-
Constructor Summary
Constructors Constructor Description CountOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CountOptions
collationβ(Collation collation)
Sets the collation optionsCollation
getCollation()
Returns the collation optionsBson
getHint()
Gets the hint to apply.String
getHintString()
Gets the hint string to apply.int
getLimit()
Gets the limit to apply.long
getMaxTimeβ(TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.int
getSkip()
Gets the number of documents to skip.CountOptions
hintβ(Bson hint)
Sets the hint to apply.CountOptions
hintStringβ(String hint)
Sets the hint to apply.CountOptions
limitβ(int limit)
Sets the limit to apply.CountOptions
maxTimeβ(long maxTime, TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.CountOptions
skipβ(int skip)
Sets the number of documents to skip.String
toString()
-
-
-
Method Detail
-
getHint
@Nullable public Bson getHint()
Gets the hint to apply.- Returns:
- the hint, which should describe an existing
-
getHintString
@Nullable public String getHintString()
Gets the hint string to apply.- Returns:
- the hint string, which should be the name of an existing index
-
hint
public CountOptions hintβ(@Nullable Bson hint)
Sets the hint to apply.- Parameters:
hint
- a document describing the index which should be used for this operation.- Returns:
- this
-
hintString
public CountOptions hintStringβ(@Nullable String hint)
Sets the hint to apply.Note: If
hint(Bson)
is set that will be used instead of any hint string.- Parameters:
hint
- the name of the index which should be used for the operation- Returns:
- this
-
getLimit
public int getLimit()
Gets the limit to apply. The default is 0, which means there is no limit.- Returns:
- the limit
- MongoDB documentation
- Limit
-
limit
public CountOptions limitβ(int limit)
Sets the limit to apply.- Parameters:
limit
- the limit- Returns:
- this
- MongoDB documentation
- Limit
-
getSkip
public int getSkip()
Gets the number of documents to skip. The default is 0.- Returns:
- the number of documents to skip
- MongoDB documentation
- Skip
-
skip
public CountOptions skipβ(int skip)
Sets the number of documents to skip.- Parameters:
skip
- the number of documents to skip- Returns:
- this
- MongoDB documentation
- Skip
-
getMaxTime
public long getMaxTimeβ(TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum execution time in the given time unit
-
maxTime
public CountOptions maxTimeβ(long maxTime, TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.- Parameters:
maxTime
- the max timetimeUnit
- the time unit, which may not be null- Returns:
- this
-
getCollation
@Nullable public Collation getCollation()
Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- Since server release
- 3.4
-
collation
public CountOptions collationβ(@Nullable Collation collation)
Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 3.4
- Since server release
- 3.4
-
-