Package com.mongodb.connection
Interface Connection
-
- All Superinterfaces:
ReferenceCounted
@ThreadSafe @Deprecated public interface Connection extends ReferenceCounted
Deprecated.A synchronous connection to a MongoDB server with blocking operations.Implementations of this class are thread safe.
This interface is not stable. While methods will not be removed, new ones may be added.
- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods 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)
Deprecated.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)
Deprecated.Executes the command, consuming as much of theSplittablePayload
as possible.WriteConcernResult
delete(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest)
Deprecated.Delete the documents using the delete wire protocol and apply the write concern.ConnectionDescription
getDescription()
Deprecated.Gets the description of the connection.<T> QueryResult<T>
getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder)
Deprecated.Get more result documents from a cursor.WriteConcernResult
insert(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest)
Deprecated.Insert the documents using the insert wire protocol and apply the write concern.void
killCursor(MongoNamespace namespace, List<Long> cursors)
Deprecated.Kills the given list of cursors.void
killCursor(List<Long> cursors)
Deprecated.Replaced bykillCursor(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)
Deprecated.Execute the query.Connection
retain()
Deprecated.Retain an additional reference to this object.WriteConcernResult
update(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest)
Deprecated.Update the documents using the update wire protocol and apply the write concern.-
Methods inherited from interface com.mongodb.binding.ReferenceCounted
getCount, release
-
-
-
-
Method Detail
-
retain
Connection retain()
Deprecated.Description copied from interface:ReferenceCounted
Retain an additional reference to this object. All retained references must be released, or there will be a leak.- Specified by:
retain
in interfaceReferenceCounted
- Returns:
- this
-
getDescription
ConnectionDescription getDescription()
Deprecated.Gets the description of the connection.- Returns:
- the connection description
-
insert
WriteConcernResult insert(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest)
Deprecated.Insert the documents using the insert wire protocol and apply the write concern.- Parameters:
namespace
- the namespaceordered
- whether the writes are orderedinsertRequest
- the insert request- Returns:
- the write concern result
-
update
WriteConcernResult update(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest)
Deprecated.Update the documents using the update wire protocol and apply the write concern.- Parameters:
namespace
- the namespaceordered
- whether the writes are orderedupdateRequest
- the update request- Returns:
- the write concern result
-
delete
WriteConcernResult delete(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest)
Deprecated.Delete the documents using the delete wire protocol and apply the write concern.- Parameters:
namespace
- the namespaceordered
- whether the writes are ordereddeleteRequest
- the delete request- Returns:
- the write concern result
-
command
@Deprecated <T> T command(String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder)
Deprecated.Execute the command.- Type Parameters:
T
- the type of the result- Parameters:
database
- 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- Returns:
- the command result
-
command
<T> T command(String database, BsonDocument command, FieldNameValidator fieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext)
Deprecated.Execute the command.- Type Parameters:
T
- the type of the result- Parameters:
database
- 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- Returns:
- the command result
- Since:
- 3.6
-
command
<T> T command(String database, BsonDocument command, FieldNameValidator commandFieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, boolean responseExpected, SplittablePayload payload, FieldNameValidator payloadFieldNameValidator)
Deprecated.Executes the command, consuming as much of theSplittablePayload
as possible.- Type Parameters:
T
- the type of the result- Parameters:
database
- 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- Returns:
- the command result
- Since:
- 3.6
-
query
@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)
Deprecated.Execute the query.- Type Parameters:
T
- the query result document type- Parameters:
namespace
- 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- Returns:
- the query results
-
query
<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)
Deprecated.Execute the query.- Type Parameters:
T
- the query result document type- Parameters:
namespace
- 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- Returns:
- the query results
- Since:
- 3.1
-
getMore
<T> QueryResult<T> getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder)
Deprecated.Get more result documents from a cursor.- Type Parameters:
T
- the type of the query result documents- Parameters:
namespace
- the namespace to get more documents fromcursorId
- the cursor idnumberToReturn
- the number of documents to returnresultDecoder
- the decoder for the query results- Returns:
- the query results
-
killCursor
@Deprecated void killCursor(List<Long> cursors)
Deprecated.Replaced bykillCursor(MongoNamespace, List)
Kills the given list of cursors.- Parameters:
cursors
- the cursors
-
killCursor
void killCursor(MongoNamespace namespace, List<Long> cursors)
Deprecated.Kills the given list of cursors.- Parameters:
namespace
- the namespace to in which the cursors livecursors
- the cursors
-
-