@ThreadSafe public interface Connection extends ReferenceCounted
Implementations of this class are thread safe.
This interface is not stable. While methods will not be removed, new ones may be added.
Modifier and Type | Method and Description |
---|---|
<T> T |
command(String database,
BsonDocument command,
boolean slaveOk,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder)
|
<T> T |
command(String database,
BsonDocument command,
ReadPreference readPreference,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder,
SessionContext sessionContext)
Execute the command.
|
WriteConcernResult |
delete(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<DeleteRequest> deletes)
Delete the documents using the delete wire protocol and apply the write concern.
|
BulkWriteResult |
deleteCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<DeleteRequest> deletes)
Deprecated.
|
BulkWriteResult |
deleteCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<DeleteRequest> deletes,
SessionContext sessionContext)
Delete the documents using the delete command.
|
ConnectionDescription |
getDescription()
Gets the description of the connection.
|
<T> QueryResult<T> |
getMore(MongoNamespace namespace,
long cursorId,
int numberToReturn,
Decoder<T> resultDecoder)
Get more result documents from a cursor.
|
WriteConcernResult |
insert(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<InsertRequest> inserts)
Insert the documents using the insert wire protocol and apply the write concern.
|
BulkWriteResult |
insertCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
Boolean bypassDocumentValidation,
List<InsertRequest> inserts)
|
BulkWriteResult |
insertCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
Boolean bypassDocumentValidation,
List<InsertRequest> inserts,
SessionContext sessionContext)
Insert the documents using the insert command.
|
BulkWriteResult |
insertCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<InsertRequest> inserts)
Deprecated.
|
void |
killCursor(List<Long> cursors)
Deprecated.
Replaced by
killCursor(MongoNamespace, List) |
void |
killCursor(MongoNamespace namespace,
List<Long> cursors)
Kills the given list of cursors.
|
<T> QueryResult<T> |
query(MongoNamespace namespace,
BsonDocument queryDocument,
BsonDocument fields,
int numberToReturn,
int skip,
boolean slaveOk,
boolean tailableCursor,
boolean awaitData,
boolean noCursorTimeout,
boolean partial,
boolean oplogReplay,
Decoder<T> resultDecoder)
|
<T> QueryResult<T> |
query(MongoNamespace namespace,
BsonDocument queryDocument,
BsonDocument fields,
int skip,
int limit,
int batchSize,
boolean slaveOk,
boolean tailableCursor,
boolean awaitData,
boolean noCursorTimeout,
boolean partial,
boolean oplogReplay,
Decoder<T> resultDecoder)
Execute the query.
|
Connection |
retain()
Retain an additional reference to this object.
|
WriteConcernResult |
update(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<UpdateRequest> updates)
Update the documents using the update wire protocol and apply the write concern.
|
BulkWriteResult |
updateCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
Boolean bypassDocumentValidation,
List<UpdateRequest> updates)
|
BulkWriteResult |
updateCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
Boolean bypassDocumentValidation,
List<UpdateRequest> updates,
SessionContext sessionContext)
Update the documents using the update command.
|
BulkWriteResult |
updateCommand(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
List<UpdateRequest> updates)
Deprecated.
|
getCount, release
Connection retain()
ReferenceCounted
retain
in interface ReferenceCounted
ConnectionDescription getDescription()
WriteConcernResult insert(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<InsertRequest> inserts)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concerninserts
- the insertsWriteConcernResult update(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<UpdateRequest> updates)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concernupdates
- the updatesWriteConcernResult delete(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<DeleteRequest> deletes)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concerndeletes
- the deletes@Deprecated BulkWriteResult insertCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<InsertRequest> inserts)
insertCommand(MongoNamespace, boolean, WriteConcern, Boolean, List)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concerninserts
- the inserts@Deprecated BulkWriteResult insertCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, Boolean bypassDocumentValidation, List<InsertRequest> inserts)
insertCommand(MongoNamespace, boolean, WriteConcern, Boolean, List, SessionContext)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concernbypassDocumentValidation
- the bypassDocumentValidation flaginserts
- the insertsBulkWriteResult insertCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, Boolean bypassDocumentValidation, List<InsertRequest> inserts, SessionContext sessionContext)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concernbypassDocumentValidation
- the bypassDocumentValidation flaginserts
- the insertssessionContext
- the session context@Deprecated BulkWriteResult updateCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<UpdateRequest> updates)
updateCommand(MongoNamespace, boolean, WriteConcern, Boolean, List, SessionContext)
}namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concernupdates
- the updates@Deprecated BulkWriteResult updateCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, Boolean bypassDocumentValidation, List<UpdateRequest> updates)
updateCommand(MongoNamespace, boolean, WriteConcern, Boolean, List, SessionContext)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concernbypassDocumentValidation
- the bypassDocumentValidation flagupdates
- the updatesBulkWriteResult updateCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, Boolean bypassDocumentValidation, List<UpdateRequest> updates, SessionContext sessionContext)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concernbypassDocumentValidation
- the bypassDocumentValidation flagupdates
- the updatessessionContext
- the session context@Deprecated BulkWriteResult deleteCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<DeleteRequest> deletes)
deleteCommand(MongoNamespace, boolean, WriteConcern, List, SessionContext)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concerndeletes
- the deletesBulkWriteResult deleteCommand(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, List<DeleteRequest> deletes, SessionContext sessionContext)
namespace
- the namespaceordered
- whether the writes are orderedwriteConcern
- the write concerndeletes
- the deletessessionContext
- the session context@Deprecated <T> T command(String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder)
command(String, BsonDocument, ReadPreference, FieldNameValidator, Decoder, SessionContext)
T
- the type of the resultdatabase
- the database to execute the command incommand
- the command documentslaveOk
- whether the command can run on a secondaryfieldNameValidator
- the field name validator for the command documentcommandResultDecoder
- the decoder for the result<T> T command(String database, BsonDocument command, ReadPreference readPreference, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder, SessionContext sessionContext)
T
- the type of the resultdatabase
- the database to execute the command incommand
- the command documentreadPreference
- the read preference that was applied to get this connectionfieldNameValidator
- the field name validator for the command documentcommandResultDecoder
- the decoder for the resultsessionContext
- the session context@Deprecated <T> QueryResult<T> query(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int numberToReturn, int skip, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder)
query(MongoNamespace, BsonDocument, BsonDocument, int, int, int, boolean, boolean, boolean,
boolean, boolean, boolean, Decoder)
T
- the query result document typenamespace
- the namespace to queryqueryDocument
- the query documentfields
- the field to include or excludenumberToReturn
- the number of documents to returnskip
- the number of documents to skipslaveOk
- whether the query can run on a secondarytailableCursor
- whether to return a tailable cursorawaitData
- whether a tailable cursor should wait before returning if no documents are availablenoCursorTimeout
- whether the cursor should not timeoutpartial
- whether partial results from sharded clusters are acceptableoplogReplay
- whether to replay the oplogresultDecoder
- the decoder for the query result documents<T> QueryResult<T> query(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int skip, int limit, int batchSize, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder)
T
- the query result document typenamespace
- the namespace to queryqueryDocument
- the query documentfields
- the field to include or excludeskip
- the number of documents to skiplimit
- the maximum number of documents to return in all batchesbatchSize
- the maximum number of documents to return in this batchslaveOk
- whether the query can run on a secondarytailableCursor
- whether to return a tailable cursorawaitData
- whether a tailable cursor should wait before returning if no documents are availablenoCursorTimeout
- whether the cursor should not timeoutpartial
- whether partial results from sharded clusters are acceptableoplogReplay
- whether to replay the oplogresultDecoder
- the decoder for the query result documents<T> QueryResult<T> getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder)
T
- the type of the query result documentsnamespace
- the namespace to get more documents fromcursorId
- the cursor idnumberToReturn
- the number of documents to returnresultDecoder
- the decoder for the query results@Deprecated void killCursor(List<Long> cursors)
killCursor(MongoNamespace, List)
cursors
- the cursorsvoid killCursor(MongoNamespace namespace, List<Long> cursors)
namespace
- the namespace to in which the cursors livecursors
- the cursors