public interface MongoClient extends Closeable
Modifier and Type | Method and Description |
---|---|
MongoClient |
asSerializedClient()
Returns a MongoClient instance that shares connections with this
MongoClient instance but serializes all of its requests on a single
connection.
|
MongoClientConfiguration |
getConfig()
Returns the configuration being used by the logical MongoDB connection.
|
MongoDatabase |
getDatabase(String name)
Returns the MongoDatabase with the specified name.
|
List<String> |
listDatabaseNames()
Returns a list of database names.
|
List<String> |
listDatabases()
Deprecated.
Use the
listDatabaseNames() method instead. |
MongoIterator<Document> |
restart(DocumentAssignable cursorDocument)
Restarts an iterator that was previously saved.
|
MongoCursorControl |
restart(LambdaCallback<Document> results,
DocumentAssignable cursorDocument)
Restarts a document stream from a cursor that was previously saved.
|
MongoCursorControl |
restart(StreamCallback<Document> results,
DocumentAssignable cursorDocument)
Restarts a document stream from a cursor that was previously saved.
|
MongoClient asSerializedClient()
While the returned MongoClient instance is thread safe it is intended to be used by a single logical thread to ensure requests issued to the MongoDB server are guaranteed to be processed in the same order they are requested.
Creation of the serial instance is lightweight with minimal object allocation and no server interaction.
MongoClientConfiguration getConfig()
MongoDatabase getDatabase(String name)
name
- The name of the existing database.MongoDatabase
.List<String> listDatabaseNames()
@Deprecated List<String> listDatabases()
listDatabaseNames()
method instead.MongoIterator<Document> restart(DocumentAssignable cursorDocument) throws IllegalArgumentException
cursorDocument
- The document containing the state of the cursor.IllegalArgumentException
- If the document does not contain a valid cursor state.MongoCursorControl restart(LambdaCallback<Document> results, DocumentAssignable cursorDocument) throws IllegalArgumentException
The sequence of callbacks will be terminated by either calling the
results.accept(...)
method with null
for both parameters or by calling the
method with an error for the first parameter.
results
- Callback that will be notified of the results of the cursor.cursorDocument
- The document containing the state of the cursor.MongoCursorControl
to control the cursor streaming
documents to the caller. This includes the ability to stop the
cursor and persist its state.IllegalArgumentException
- If the document does not contain a valid cursor state.MongoCursorControl restart(StreamCallback<Document> results, DocumentAssignable cursorDocument) throws IllegalArgumentException
results
- Callback that will be notified of the results of the cursor.cursorDocument
- The document containing the state of the cursor.MongoCursorControl
to control the cursor streaming
documents to the caller. This includes the ability to stop the
cursor and persist its state.IllegalArgumentException
- If the document does not contain a valid cursor state.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.