ReferenceCounted
@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 | Description |
---|---|---|
<T> T |
command(String database,
BsonDocument command,
boolean slaveOk,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder) |
|
<T> T |
command(String database,
BsonDocument command,
FieldNameValidator fieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext) |
Execute the command.
|
<T> T |
command(String database,
BsonDocument command,
FieldNameValidator commandFieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext,
boolean responseExpected,
SplittablePayload payload,
FieldNameValidator payloadFieldNameValidator) |
Executes the command, consuming as much of the
SplittablePayload as possible. |
WriteConcernResult |
delete(MongoNamespace namespace,
boolean ordered,
DeleteRequest deleteRequest) |
Delete the documents using the delete wire protocol and apply the write concern.
|
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,
InsertRequest insertRequest) |
Insert the documents using the insert wire protocol and apply the write concern.
|
void |
killCursor(MongoNamespace namespace,
List<Long> cursors) |
Kills the given list of cursors.
|
void |
killCursor(List<Long> cursors) |
Deprecated.
Replaced by
killCursor(MongoNamespace, List) |
<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,
UpdateRequest updateRequest) |
Update the documents using the update wire protocol and apply the write concern.
|
getCount, release
Connection retain()
ReferenceCounted
retain
in interface ReferenceCounted
ConnectionDescription getDescription()
WriteConcernResult insert(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest)
namespace
- the namespaceordered
- whether the writes are orderedinsertRequest
- the insert requestWriteConcernResult update(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest)
namespace
- the namespaceordered
- whether the writes are orderedupdateRequest
- the update requestWriteConcernResult delete(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest)
namespace
- the namespaceordered
- whether the writes are ordereddeleteRequest
- the delete request@Deprecated <T> T command(String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder)
command(String, BsonDocument, FieldNameValidator, ReadPreference, 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, FieldNameValidator fieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext)
T
- the type of the resultdatabase
- the database to execute the command incommand
- the command documentfieldNameValidator
- the field name validator for the command documentreadPreference
- the read preference that was applied to get this connection, or null if this is a write operationcommandResultDecoder
- the decoder for the resultsessionContext
- the session context<T> T command(String database, BsonDocument command, FieldNameValidator commandFieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, boolean responseExpected, SplittablePayload payload, FieldNameValidator payloadFieldNameValidator)
SplittablePayload
as possible.T
- the type of the resultdatabase
- the database to execute the command incommand
- the command documentcommandFieldNameValidator
- the field name validator for the command documentreadPreference
- the read preference that was applied to get this connection, or null if this is a write operationcommandResultDecoder
- the decoder for the resultsessionContext
- the session contextresponseExpected
- true if a response from the server is expectedpayload
- the splittable payload to incorporate with the commandpayloadFieldNameValidator
- the field name validator for the payload documents@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