Package dev.morphia.query
Class CountOptions
- java.lang.Object
-
- dev.morphia.query.CountOptions
-
public class CountOptions extends java.lang.Object
The options for a count operation.- Since:
- 1.3
- MongoDB documentation
- reference/command/count/ Count
-
-
Constructor Summary
Constructors Constructor Description CountOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CountOptions
collation(com.mongodb.client.model.Collation collation)
Sets the collationcom.mongodb.client.model.Collation
getCollation()
Returns the collation optionsjava.lang.String
getHint()
Gets the hint to apply.int
getLimit()
Gets the limit to apply.long
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.com.mongodb.ReadConcern
getReadConcern()
Returns the readConcerncom.mongodb.ReadPreference
getReadPreference()
Returns the readPreferenceint
getSkip()
Gets the number of documents to skip.CountOptions
hint(java.lang.String hint)
Sets the hint to apply.CountOptions
limit(int limit)
Sets the limit to apply.CountOptions
maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.CountOptions
readConcern(com.mongodb.ReadConcern readConcern)
Sets the readConcernCountOptions
readPreference(com.mongodb.ReadPreference readPreference)
Sets the readPreferenceCountOptions
skip(int skip)
Sets the number of documents to skip.
-
-
-
Method Detail
-
collation
public CountOptions collation(com.mongodb.client.model.Collation collation)
Sets the collation- Parameters:
collation
- the collation- Returns:
- this
- Since server release
- 3.4
-
getCollation
public com.mongodb.client.model.Collation getCollation()
Returns the collation options- Returns:
- the collation options
- Since server release
- 3.4
-
getHint
public java.lang.String getHint()
Gets the hint to apply.- Returns:
- the hint, which should describe an existing
-
getLimit
public int getLimit()
Gets the limit to apply. The default is 0, which means there is no limit.- Returns:
- the limit
- MongoDB documentation
- reference/method/cursor.limit/#cursor.limit Limit
-
getMaxTime
public long getMaxTime(java.util.concurrent.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
-
getReadConcern
public com.mongodb.ReadConcern getReadConcern()
Returns the readConcern- Returns:
- the readConcern
- Since server release
- 3.2
-
getReadPreference
public com.mongodb.ReadPreference getReadPreference()
Returns the readPreference- Returns:
- the readPreference
-
getSkip
public int getSkip()
Gets the number of documents to skip. The default is 0.- Returns:
- the number of documents to skip
- MongoDB documentation
- reference/method/cursor.skip/#cursor.skip Skip
-
hint
public CountOptions hint(java.lang.String hint)
Sets the hint to apply.- Parameters:
hint
- the name of the index which should be used for the operation- Returns:
- this
-
limit
public CountOptions limit(int limit)
Sets the limit to apply.- Parameters:
limit
- the limit- Returns:
- this
- MongoDB documentation
- reference/method/cursor.limit/#cursor.limit Limit
-
maxTime
public CountOptions maxTime(long maxTime, java.util.concurrent.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
-
readConcern
public CountOptions readConcern(com.mongodb.ReadConcern readConcern)
Sets the readConcern- Parameters:
readConcern
- the readConcern- Returns:
- this
- Since server release
- 3.2
-
readPreference
public CountOptions readPreference(com.mongodb.ReadPreference readPreference)
Sets the readPreference- Parameters:
readPreference
- the readPreference- Returns:
- this
-
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
- reference/method/cursor.skip/#cursor.skip Skip
-
-