Class DefaultServerConnection

    • Method Detail

      • insert

        public WriteConcernResult insert​(MongoNamespace namespace,
                                         boolean ordered,
                                         InsertRequest insertRequest)
        Deprecated.
        Description copied from interface: Connection
        Insert the documents using the insert wire protocol and apply the write concern.
        Specified by:
        insert in interface Connection
        Parameters:
        namespace - the namespace
        ordered - whether the writes are ordered
        insertRequest - the insert request
        Returns:
        the write concern result
      • insertAsync

        public void insertAsync​(MongoNamespace namespace,
                                boolean ordered,
                                InsertRequest insertRequest,
                                SingleResultCallback<WriteConcernResult> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Insert the documents using the insert wire protocol and apply the write concern asynchronously.
        Specified by:
        insertAsync in interface AsyncConnection
        Parameters:
        namespace - the namespace
        ordered - whether the writes are ordered
        insertRequest - the insert request
        callback - the callback to be passed the write result
      • update

        public WriteConcernResult update​(MongoNamespace namespace,
                                         boolean ordered,
                                         UpdateRequest updateRequest)
        Deprecated.
        Description copied from interface: Connection
        Update the documents using the update wire protocol and apply the write concern.
        Specified by:
        update in interface Connection
        Parameters:
        namespace - the namespace
        ordered - whether the writes are ordered
        updateRequest - the update request
        Returns:
        the write concern result
      • updateAsync

        public void updateAsync​(MongoNamespace namespace,
                                boolean ordered,
                                UpdateRequest updateRequest,
                                SingleResultCallback<WriteConcernResult> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Update the documents using the update wire protocol and apply the write concern asynchronously.
        Specified by:
        updateAsync in interface AsyncConnection
        Parameters:
        namespace - the namespace
        ordered - whether the writes are ordered
        updateRequest - the update request
        callback - the callback to be passed the write result
      • delete

        public WriteConcernResult delete​(MongoNamespace namespace,
                                         boolean ordered,
                                         DeleteRequest deleteRequest)
        Deprecated.
        Description copied from interface: Connection
        Delete the documents using the delete wire protocol and apply the write concern.
        Specified by:
        delete in interface Connection
        Parameters:
        namespace - the namespace
        ordered - whether the writes are ordered
        deleteRequest - the delete request
        Returns:
        the write concern result
      • deleteAsync

        public void deleteAsync​(MongoNamespace namespace,
                                boolean ordered,
                                DeleteRequest deleteRequest,
                                SingleResultCallback<WriteConcernResult> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Delete the documents using the delete wire protocol and apply the write concern asynchronously.
        Specified by:
        deleteAsync in interface AsyncConnection
        Parameters:
        namespace - the namespace
        ordered - whether the writes are ordered
        deleteRequest - the delete request
        callback - the callback to be passed the write result
      • command

        public <T> T command​(java.lang.String database,
                             BsonDocument command,
                             boolean slaveOk,
                             FieldNameValidator fieldNameValidator,
                             Decoder<T> commandResultDecoder)
        Deprecated.
        Description copied from interface: Connection
        Execute the command.
        Specified by:
        command in interface Connection
        Type Parameters:
        T - the type of the result
        Parameters:
        database - the database to execute the command in
        command - the command document
        slaveOk - whether the command can run on a secondary
        fieldNameValidator - the field name validator for the command document
        commandResultDecoder - the decoder for the result
        Returns:
        the command result
      • command

        public <T> T command​(java.lang.String database,
                             BsonDocument command,
                             FieldNameValidator fieldNameValidator,
                             ReadPreference readPreference,
                             Decoder<T> commandResultDecoder,
                             SessionContext sessionContext)
        Deprecated.
        Description copied from interface: Connection
        Execute the command.
        Specified by:
        command in interface Connection
        Type Parameters:
        T - the type of the result
        Parameters:
        database - the database to execute the command in
        command - the command document
        fieldNameValidator - the field name validator for the command document
        readPreference - the read preference that was applied to get this connection, or null if this is a write operation
        commandResultDecoder - the decoder for the result
        sessionContext - the session context
        Returns:
        the command result
      • command

        public <T> T command​(java.lang.String database,
                             BsonDocument command,
                             FieldNameValidator commandFieldNameValidator,
                             ReadPreference readPreference,
                             Decoder<T> commandResultDecoder,
                             SessionContext sessionContext,
                             boolean responseExpected,
                             SplittablePayload payload,
                             FieldNameValidator payloadFieldNameValidator)
        Deprecated.
        Description copied from interface: Connection
        Executes the command, consuming as much of the SplittablePayload as possible.
        Specified by:
        command in interface Connection
        Type Parameters:
        T - the type of the result
        Parameters:
        database - the database to execute the command in
        command - the command document
        commandFieldNameValidator - the field name validator for the command document
        readPreference - the read preference that was applied to get this connection, or null if this is a write operation
        commandResultDecoder - the decoder for the result
        sessionContext - the session context
        responseExpected - true if a response from the server is expected
        payload - the splittable payload to incorporate with the command
        payloadFieldNameValidator - the field name validator for the payload documents
        Returns:
        the command result
      • commandAsync

        public <T> void commandAsync​(java.lang.String database,
                                     BsonDocument command,
                                     boolean slaveOk,
                                     FieldNameValidator fieldNameValidator,
                                     Decoder<T> commandResultDecoder,
                                     SingleResultCallback<T> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Execute the command asynchronously.
        Specified by:
        commandAsync in interface AsyncConnection
        Type Parameters:
        T - the type of the result
        Parameters:
        database - the database to execute the command in
        command - the command document
        slaveOk - whether the command can run on a secondary
        fieldNameValidator - the field name validator for the command document
        commandResultDecoder - the decoder for the result
        callback - the callback to be passed the command result
      • commandAsync

        public <T> void commandAsync​(java.lang.String database,
                                     BsonDocument command,
                                     FieldNameValidator fieldNameValidator,
                                     ReadPreference readPreference,
                                     Decoder<T> commandResultDecoder,
                                     SessionContext sessionContext,
                                     SingleResultCallback<T> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Execute the command.
        Specified by:
        commandAsync in interface AsyncConnection
        Type Parameters:
        T - the type of the result
        Parameters:
        database - the database to execute the command in
        command - the command document
        fieldNameValidator - the field name validator for the command document
        readPreference - the read preference that was applied to get this connection, or null if this is a write operation
        commandResultDecoder - the decoder for the result
        sessionContext - the session context
        callback - the callback to be passed the write result
      • commandAsync

        public <T> void commandAsync​(java.lang.String database,
                                     BsonDocument command,
                                     FieldNameValidator commandFieldNameValidator,
                                     ReadPreference readPreference,
                                     Decoder<T> commandResultDecoder,
                                     SessionContext sessionContext,
                                     boolean responseExpected,
                                     SplittablePayload payload,
                                     FieldNameValidator payloadFieldNameValidator,
                                     SingleResultCallback<T> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Executes the command, consuming as much of the SplittablePayload as possible.
        Specified by:
        commandAsync in interface AsyncConnection
        Type Parameters:
        T - the type of the result
        Parameters:
        database - the database to execute the command in
        command - the command document
        commandFieldNameValidator - the field name validator for the command document
        readPreference - the read preference that was applied to get this connection, or null if this is a write operation
        commandResultDecoder - the decoder for the result
        sessionContext - the session context
        responseExpected - true if a response from the server is expected
        payload - the splittable payload to incorporate with the command
        payloadFieldNameValidator - the field name validator for the payload documents
        callback - the callback to be passed the write result
      • query

        public <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.
        Description copied from interface: Connection
        Execute the query.
        Specified by:
        query in interface Connection
        Type Parameters:
        T - the query result document type
        Parameters:
        namespace - the namespace to query
        queryDocument - the query document
        fields - the field to include or exclude
        numberToReturn - the number of documents to return
        skip - the number of documents to skip
        slaveOk - whether the query can run on a secondary
        tailableCursor - whether to return a tailable cursor
        awaitData - whether a tailable cursor should wait before returning if no documents are available
        noCursorTimeout - whether the cursor should not timeout
        partial - whether partial results from sharded clusters are acceptable
        oplogReplay - whether to replay the oplog
        resultDecoder - the decoder for the query result documents
        Returns:
        the query results
      • query

        public <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.
        Description copied from interface: Connection
        Execute the query.
        Specified by:
        query in interface Connection
        Type Parameters:
        T - the query result document type
        Parameters:
        namespace - the namespace to query
        queryDocument - the query document
        fields - the field to include or exclude
        skip - the number of documents to skip
        limit - the maximum number of documents to return in all batches
        batchSize - the maximum number of documents to return in this batch
        slaveOk - whether the query can run on a secondary
        tailableCursor - whether to return a tailable cursor
        awaitData - whether a tailable cursor should wait before returning if no documents are available
        noCursorTimeout - whether the cursor should not timeout
        partial - whether partial results from sharded clusters are acceptable
        oplogReplay - whether to replay the oplog
        resultDecoder - the decoder for the query result documents
        Returns:
        the query results
      • queryAsync

        public <T> void queryAsync​(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,
                                   SingleResultCallback<QueryResult<T>> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Execute the query asynchronously.
        Specified by:
        queryAsync in interface AsyncConnection
        Type Parameters:
        T - the query result document type
        Parameters:
        namespace - the namespace to query
        queryDocument - the query document
        fields - the field to include or exclude
        numberToReturn - the number of documents to return
        skip - the number of documents to skip
        slaveOk - whether the query can run on a secondary
        tailableCursor - whether to return a tailable cursor
        awaitData - whether a tailable cursor should wait before returning if no documents are available
        noCursorTimeout - whether the cursor should not timeout
        partial - whether partial results from sharded clusters are acceptable
        oplogReplay - whether to replay the oplog
        resultDecoder - the decoder for the query result documents
        callback - the callback to be passed the write result
      • queryAsync

        public <T> void queryAsync​(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,
                                   SingleResultCallback<QueryResult<T>> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Execute the query asynchronously.
        Specified by:
        queryAsync in interface AsyncConnection
        Type Parameters:
        T - the query result document type
        Parameters:
        namespace - the namespace to query
        queryDocument - the query document
        fields - the field to include or exclude
        skip - the number of documents to skip
        limit - the maximum number of documents to return in all batches
        batchSize - the maximum number of documents to return in this batch
        slaveOk - whether the query can run on a secondary
        tailableCursor - whether to return a tailable cursor
        awaitData - whether a tailable cursor should wait before returning if no documents are available
        noCursorTimeout - whether the cursor should not timeout
        partial - whether partial results from sharded clusters are acceptable
        oplogReplay - whether to replay the oplog
        resultDecoder - the decoder for the query result documents
        callback - the callback to be passed the write result
      • getMore

        public <T> QueryResult<T> getMore​(MongoNamespace namespace,
                                          long cursorId,
                                          int numberToReturn,
                                          Decoder<T> resultDecoder)
        Deprecated.
        Description copied from interface: Connection
        Get more result documents from a cursor.
        Specified by:
        getMore in interface Connection
        Type Parameters:
        T - the type of the query result documents
        Parameters:
        namespace - the namespace to get more documents from
        cursorId - the cursor id
        numberToReturn - the number of documents to return
        resultDecoder - the decoder for the query results
        Returns:
        the query results
      • getMoreAsync

        public <T> void getMoreAsync​(MongoNamespace namespace,
                                     long cursorId,
                                     int numberToReturn,
                                     Decoder<T> resultDecoder,
                                     SingleResultCallback<QueryResult<T>> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Get more result documents from a cursor asynchronously.
        Specified by:
        getMoreAsync in interface AsyncConnection
        Type Parameters:
        T - the type of the query result documents
        Parameters:
        namespace - the namespace to get more documents from
        cursorId - the cursor id
        numberToReturn - the number of documents to return
        resultDecoder - the decoder for the query result documents
        callback - the callback to be passed the query result
      • killCursor

        public void killCursor​(java.util.List<java.lang.Long> cursors)
        Deprecated.
        Description copied from interface: Connection
        Kills the given list of cursors.
        Specified by:
        killCursor in interface Connection
        Parameters:
        cursors - the cursors
      • killCursor

        public void killCursor​(MongoNamespace namespace,
                               java.util.List<java.lang.Long> cursors)
        Deprecated.
        Description copied from interface: Connection
        Kills the given list of cursors.
        Specified by:
        killCursor in interface Connection
        Parameters:
        namespace - the namespace to in which the cursors live
        cursors - the cursors
      • killCursorAsync

        public void killCursorAsync​(java.util.List<java.lang.Long> cursors,
                                    SingleResultCallback<java.lang.Void> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Asynchronously Kills the given list of cursors.
        Specified by:
        killCursorAsync in interface AsyncConnection
        Parameters:
        cursors - the cursors
        callback - the callback that is called once the cursors have been killed
      • killCursorAsync

        public void killCursorAsync​(MongoNamespace namespace,
                                    java.util.List<java.lang.Long> cursors,
                                    SingleResultCallback<java.lang.Void> callback)
        Deprecated.
        Description copied from interface: AsyncConnection
        Asynchronously Kills the given list of cursors.
        Specified by:
        killCursorAsync in interface AsyncConnection
        Parameters:
        namespace - the namespace in which the cursors live
        cursors - the cursors
        callback - the callback that is called once the cursors have been killed
      • getCount

        public int getCount()
        Deprecated.
        Description copied from interface: ReferenceCounted
        Gets the current reference count, which starts at 0.
        Specified by:
        getCount in interface ReferenceCounted
        Returns:
        the current count, which must be greater than or equal to 0