AsyncReadOperation<Long>
, ReadOperation<Long>
public class CountOperation extends Object implements AsyncReadOperation<Long>, ReadOperation<Long>
Constructor | Description |
---|---|
CountOperation(MongoNamespace namespace) |
Construct a new instance.
|
Modifier and Type | Method | 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
|
Long |
execute(ReadBinding binding) |
General execute which can return anything of type T
|
void |
executeAsync(AsyncReadBinding binding,
SingleResultCallback<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(TimeUnit timeUnit) |
Gets the maximum execution time on the server for this operation.
|
ReadConcern |
getReadConcern() |
Gets the read concern
|
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,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
CountOperation |
readConcern(ReadConcern readConcern) |
Sets the read concern
|
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 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(TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic CountOperation maxTime(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic ReadConcern getReadConcern()
public CountOperation readConcern(ReadConcern readConcern)
readConcern
- the read concernpublic Collation getCollation()
public CountOperation collation(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic Long execute(ReadBinding binding)
ReadOperation
execute
in interface ReadOperation<Long>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<Long> callback)
AsyncReadOperation
executeAsync
in interface AsyncReadOperation<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 verbosity