public class CountOperation extends java.lang.Object implements AsyncReadOperation<java.lang.Long>, ReadOperation<java.lang.Long>
Constructor and Description |
---|
CountOperation(MongoNamespace namespace)
Construct a new instance.
|
CountOperation(MongoNamespace namespace,
com.mongodb.internal.client.model.CountStrategy countStrategy)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
ReadOperation<BsonDocument> |
asExplainableOperation(ExplainVerbosity explainVerbosity)
Gets an operation whose execution explains this operation.
|
AsyncReadOperation<BsonDocument> |
asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Gets an operation whose execution explains this operation.
|
CountOperation |
collation(Collation collation)
Sets the collation options
|
java.lang.Long |
execute(ReadBinding binding)
General execute which can return anything of type T
|
void |
executeAsync(AsyncReadBinding binding,
SingleResultCallback<java.lang.Long> callback)
General execute which can return anything of type T
|
CountOperation |
filter(BsonDocument filter)
Sets the filter to apply to the query.
|
Collation |
getCollation()
Returns the collation options
|
BsonDocument |
getFilter()
Gets the query filter.
|
BsonValue |
getHint()
Gets the hint to apply.
|
long |
getLimit()
Gets the limit to apply.
|
long |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
long |
getSkip()
Gets the number of documents to skip.
|
CountOperation |
hint(BsonValue hint)
Sets the hint to apply.
|
CountOperation |
limit(long limit)
Sets the limit to apply.
|
CountOperation |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
CountOperation |
skip(long skip)
Sets the number of documents to skip.
|
public CountOperation(MongoNamespace namespace)
namespace
- the database and collection namespace for the operation.public CountOperation(MongoNamespace namespace, com.mongodb.internal.client.model.CountStrategy countStrategy)
namespace
- the database and collection namespace for the operation.countStrategy
- the strategy to use for calculating the count.public BsonDocument getFilter()
public CountOperation filter(BsonDocument filter)
filter
- the filter, which may be null.public BsonValue getHint()
public CountOperation hint(BsonValue hint)
hint
- a value describing the index which should be used for this operation.public long getLimit()
public CountOperation limit(long limit)
limit
- the limitpublic long getSkip()
public CountOperation skip(long skip)
skip
- the number of documents to skippublic long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic CountOperation maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic Collation getCollation()
public CountOperation collation(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic java.lang.Long execute(ReadBinding binding)
ReadOperation
execute
in interface ReadOperation<java.lang.Long>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<java.lang.Long> callback)
AsyncReadOperation
executeAsync
in interface AsyncReadOperation<java.lang.Long>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedpublic ReadOperation<BsonDocument> asExplainableOperation(ExplainVerbosity explainVerbosity)
explainVerbosity
- the explain verbositypublic AsyncReadOperation<BsonDocument> asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
explainVerbosity
- the explain verbosityCopyright © 2010 - 2020 Adobe. All Rights Reserved