Package com.mongodb.operation
Class CountOperation
- java.lang.Object
-
- com.mongodb.operation.CountOperation
-
- All Implemented Interfaces:
AsyncReadOperation<Long>
,ReadOperation<Long>
@Deprecated public class CountOperation extends Object implements AsyncReadOperation<Long>, ReadOperation<Long>
Deprecated.An operation that executes a count.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description CountOperation(MongoNamespace namespace)
Deprecated.Construct a new instance.CountOperation(MongoNamespace namespace, com.mongodb.internal.client.model.CountStrategy countStrategy)
Deprecated.Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ReadOperation<BsonDocument>
asExplainableOperation(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.AsyncReadOperation<BsonDocument>
asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.CountOperation
collation(Collation collation)
Deprecated.Sets the collation optionsLong
execute(ReadBinding binding)
Deprecated.General execute which can return anything of type Tvoid
executeAsync(AsyncReadBinding binding, SingleResultCallback<Long> callback)
Deprecated.General execute which can return anything of type TCountOperation
filter(BsonDocument filter)
Deprecated.Sets the filter to apply to the query.Collation
getCollation()
Deprecated.Returns the collation optionsBsonDocument
getFilter()
Deprecated.Gets the query filter.BsonValue
getHint()
Deprecated.Gets the hint to apply.long
getLimit()
Deprecated.Gets the limit to apply.long
getMaxTime(TimeUnit timeUnit)
Deprecated.Gets the maximum execution time on the server for this operation.boolean
getRetryReads()
Deprecated.Gets the value for retryable reads.long
getSkip()
Deprecated.Gets the number of documents to skip.CountOperation
hint(BsonValue hint)
Deprecated.Sets the hint to apply.CountOperation
limit(long limit)
Deprecated.Sets the limit to apply.CountOperation
maxTime(long maxTime, TimeUnit timeUnit)
Deprecated.Sets the maximum execution time on the server for this operation.CountOperation
retryReads(boolean retryReads)
Deprecated.Enables retryable reads if a read fails due to a network error.CountOperation
skip(long skip)
Deprecated.Sets the number of documents to skip.
-
-
-
Constructor Detail
-
CountOperation
public CountOperation(MongoNamespace namespace)
Deprecated.Construct a new instance.- Parameters:
namespace
- the database and collection namespace for the operation.
-
CountOperation
public CountOperation(MongoNamespace namespace, com.mongodb.internal.client.model.CountStrategy countStrategy)
Deprecated.Construct a new instance.- Parameters:
namespace
- the database and collection namespace for the operation.countStrategy
- the strategy to use for calculating the count.
-
-
Method Detail
-
getFilter
public BsonDocument getFilter()
Deprecated.Gets the query filter.- Returns:
- the query filter
- MongoDB documentation
- filter
-
filter
public CountOperation filter(BsonDocument filter)
Deprecated.Sets the filter to apply to the query.- Parameters:
filter
- the filter, which may be null.- Returns:
- this
- MongoDB documentation
- Filter
-
retryReads
public CountOperation retryReads(boolean retryReads)
Deprecated.Enables retryable reads if a read fails due to a network error.- Parameters:
retryReads
- true if reads should be retried- Returns:
- this
- Since:
- 3.11
-
getRetryReads
public boolean getRetryReads()
Deprecated.Gets the value for retryable reads. The default is true.- Returns:
- the retryable reads value
- Since:
- 3.11
-
getHint
public BsonValue getHint()
Deprecated.Gets the hint to apply.- Returns:
- the hint, which should describe an existing
-
hint
public CountOperation hint(BsonValue hint)
Deprecated.Sets the hint to apply.- Parameters:
hint
- a value describing the index which should be used for this operation.- Returns:
- this
-
getLimit
public long getLimit()
Deprecated.Gets the limit to apply. The default is 0, which means there is no limit.- Returns:
- the limit
- MongoDB documentation
- Limit
-
limit
public CountOperation limit(long limit)
Deprecated.Sets the limit to apply.- Parameters:
limit
- the limit- Returns:
- this
- MongoDB documentation
- Limit
-
getSkip
public long getSkip()
Deprecated.Gets the number of documents to skip. The default is 0.- Returns:
- the number of documents to skip, which may be null
- MongoDB documentation
- Skip
-
skip
public CountOperation skip(long skip)
Deprecated.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)
Deprecated.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 CountOperation maxTime(long maxTime, TimeUnit timeUnit)
Deprecated.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
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- Since server release
- 3.4
-
collation
public CountOperation collation(Collation collation)
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
-
execute
public Long execute(ReadBinding binding)
Deprecated.Description copied from interface:ReadOperation
General execute which can return anything of type T- Specified by:
execute
in interfaceReadOperation<Long>
- Parameters:
binding
- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
public void executeAsync(AsyncReadBinding binding, SingleResultCallback<Long> callback)
Deprecated.Description copied from interface:AsyncReadOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncReadOperation<Long>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-
asExplainableOperation
public ReadOperation<BsonDocument> asExplainableOperation(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.- Parameters:
explainVerbosity
- the explain verbosity- Returns:
- a read operation that when executed will explain this operation
-
asExplainableOperationAsync
public AsyncReadOperation<BsonDocument> asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.- Parameters:
explainVerbosity
- the explain verbosity- Returns:
- a read operation that when executed will explain this operation
-
-