driver-legacy/src/main/com/mongodb/DBCollection.java
@Nullable
    public DBObject findAndModify(@Nullable final DBObject query, @Nullable final DBObject fields, @Nullable final DBObject sort,
                                  final boolean remove, @Nullable final DBObject update,
                                  final boolean returnNew, final boolean upsert,
                                  final long maxTime, final TimeUnit maxTimeUnit) {
        return findAndModify(query, fields, sort, remove, update, returnNew, upsert, maxTime, maxTimeUnit, getWriteConcern());

    }
@Nullable
    public DBObject findAndModify(@Nullable final DBObject query, @Nullable final DBObject fields, @Nullable final DBObject sort,
                                  final boolean remove, @Nullable final DBObject update,
                                  final boolean returnNew, final boolean upsert,
                                  final long maxTime, final TimeUnit maxTimeUnit) {
        return findAndModify(query, fields, sort, remove, update, returnNew, upsert, maxTime, maxTimeUnit, getWriteConcern());

    }
Atomically modify and return a single document. By default, the returned document does not include the modifications made on the
update.

@param query       specifies the selection criteria for the modification
@param fields      a subset of fields to return
@param sort        determines which document the operation will modify if the query selects multiple documents
@param remove      when true, removes the selected document
@param returnNew   when true, returns the modified document rather than the original
@param update      the modifications to apply
@param upsert      when true, operation creates a new document if the query returns no documents
@param maxTime     the maximum time that the server will allow this operation to execute before killing it. A non-zero value requires
a server version &gt;= 2.6
@param maxTimeUnit the unit that maxTime is specified in
@return the document as it was before the modifications, unless {@code returnNew} is true, in which case it returns the document
after the changes were made
@throws WriteConcernException if the write failed due some other failure specific to the update command
@throws MongoException if the operation failed for some other reason
@mongodb.driver.manual reference/command/findAndModify/ Find and Modify
@since 2.12.0