T
- the document typepublic class ListDatabasesOperation<T> extends java.lang.Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
Modifier and Type | Field and Description |
---|---|
private Decoder<T> |
decoder |
private BsonDocument |
filter |
private long |
maxTimeMS |
private java.lang.Boolean |
nameOnly |
Constructor and Description |
---|
ListDatabasesOperation(Decoder<T> decoder)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
private CommandOperationHelper.CommandTransformer<BsonDocument,AsyncBatchCursor<T>> |
asyncTransformer(AsyncConnectionSource source,
AsyncConnection connection) |
private QueryResult<T> |
createQueryResult(BsonDocument result,
ConnectionDescription description) |
BatchCursor<T> |
execute(ReadBinding binding)
Executing this will return a list of all the databases names in the MongoDB instance.
|
void |
executeAsync(AsyncReadBinding binding,
SingleResultCallback<AsyncBatchCursor<T>> callback)
General execute which can return anything of type T
|
ListDatabasesOperation<T> |
filter(BsonDocument filter)
Sets the query filter to apply to the returned database names.
|
private BsonDocument |
getCommand() |
BsonDocument |
getFilter()
Gets the query filter to apply to the returned database names.
|
long |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
java.lang.Boolean |
getNameOnly()
Gets the nameOnly flag that indicates whether the command should return just the database names or return the database names and
size information.
|
ListDatabasesOperation<T> |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
ListDatabasesOperation<T> |
nameOnly(java.lang.Boolean nameOnly)
Sets the nameOnly flag that indicates whether the command should return just the database names or return the database names and
size information.
|
private CommandOperationHelper.CommandTransformer<BsonDocument,BatchCursor<T>> |
transformer(ConnectionSource source,
Connection connection) |
private long maxTimeMS
private BsonDocument filter
private java.lang.Boolean nameOnly
public long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic ListDatabasesOperation<T> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic ListDatabasesOperation<T> filter(BsonDocument filter)
filter
- the filter, which may be null.public BsonDocument getFilter()
public ListDatabasesOperation<T> nameOnly(java.lang.Boolean nameOnly)
nameOnly
- the nameOnly flag, which may be nullpublic java.lang.Boolean getNameOnly()
public BatchCursor<T> execute(ReadBinding binding)
execute
in interface ReadOperation<BatchCursor<T>>
binding
- the binding.public void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
AsyncReadOperation
executeAsync
in interface AsyncReadOperation<AsyncBatchCursor<T>>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprivate CommandOperationHelper.CommandTransformer<BsonDocument,BatchCursor<T>> transformer(ConnectionSource source, Connection connection)
private CommandOperationHelper.CommandTransformer<BsonDocument,AsyncBatchCursor<T>> asyncTransformer(AsyncConnectionSource source, AsyncConnection connection)
private QueryResult<T> createQueryResult(BsonDocument result, ConnectionDescription description)
private BsonDocument getCommand()