T
- the document typeAsyncReadOperation<AsyncBatchCursor<T>>
, ReadOperation<BatchCursor<T>>
public class ListCollectionsOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
name
field of each returned document is the simple name of the collection rather than the full
namespace.Constructor | Description |
---|---|
ListCollectionsOperation(String databaseName,
Decoder<T> decoder) |
Construct a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
ListCollectionsOperation<T> |
batchSize(int batchSize) |
Sets the number of documents to return per batch.
|
BatchCursor<T> |
execute(ReadBinding binding) |
General execute which can return anything of type T
|
void |
executeAsync(AsyncReadBinding binding,
SingleResultCallback<AsyncBatchCursor<T>> callback) |
General execute which can return anything of type T
|
ListCollectionsOperation<T> |
filter(BsonDocument filter) |
Sets the query filter to apply to the query.
|
Integer |
getBatchSize() |
Gets the number of documents to return per batch.
|
BsonDocument |
getFilter() |
Gets the query filter.
|
long |
getMaxTime(TimeUnit timeUnit) |
Gets the maximum execution time on the server for this operation.
|
boolean |
isNameOnly() |
Gets whether only the collection names should be returned.
|
ListCollectionsOperation<T> |
maxTime(long maxTime,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
ListCollectionsOperation<T> |
nameOnly(boolean nameOnly) |
Sets the query filter to apply to the query.
|
public BsonDocument getFilter()
public boolean isNameOnly()
public ListCollectionsOperation<T> filter(BsonDocument filter)
filter
- the filter, which may be null.public ListCollectionsOperation<T> nameOnly(boolean nameOnly)
Note: this is advisory only, and should be considered an optimization. Server versions prior to MongoDB 4.0 will ignore this request.
nameOnly
- true if only the collection names should be requested from the serverpublic Integer getBatchSize()
public ListCollectionsOperation<T> batchSize(int batchSize)
batchSize
- the batch sizepublic long getMaxTime(TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic ListCollectionsOperation<T> maxTime(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic BatchCursor<T> execute(ReadBinding binding)
ReadOperation
execute
in interface ReadOperation<T>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
AsyncReadOperation
executeAsync
in interface AsyncReadOperation<T>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed