src/main/java/org/mongojack/JacksonMongoCollection.java
/**
     * Finds the first document in the query and updates it.
     * 
     * @param query
     *            query to match
     * @param fields
     *            fields to be returned
     * @param sort
     *            sort to apply before picking first document
     * @param update
     *            update to apply. This must contain only update operators
     * @param returnNew
     *            if true, the updated document is returned, otherwise the old
     *            document is returned (or it would be lost forever)
     * @param upsert
     *            do upsert (insert if document not present)
     * @return the object
     */
Finds the first document in the query and updates it.

@param query
query to match
@param fields
fields to be returned
@param sort
sort to apply before picking first document
@param update
update to apply. This must contain only update operators
@param returnNew
if true, the updated document is returned, otherwise the old
document is returned (or it would be lost forever)
@param upsert
do upsert (insert if document not present)
@return the object
Finds the first document in the query and updates it . @param query query to match @param fields fields to be returned @param sort sort to apply before picking first document @param update update to apply . This must contain only update operators @param returnNew if true the updated document is returned otherwise the old document is returned ( or it would be lost forever ) @param upsert do upsert ( insert if document not present ) @return the object
public T findAndModify(Document query, Document fields, Document sort, Document update, boolean returnNew, boolean upsert) {
        return mongoCollection.findOneAndUpdate(serializeFields(query), update, new FindOneAndUpdateOptions().returnDocument(returnNew
                ? ReturnDocument.AFTER
                : ReturnDocument.BEFORE).projection(fields).sort(sort).upsert(upsert));
    }
public T findAndModify ( Document query , Document fields , Document sort , Document update , boolean returnNew , boolean upsert ) { return mongoCollection . findOneAndUpdate ( serializeFields ( query ) , update , new FindOneAndUpdateOptions ( ) . returnDocument ( returnNew ? ReturnDocument . AFTER : ReturnDocument . BEFORE ) . projection ( fields ) . sort ( sort ) . upsert ( upsert ) ) ; }
Finds the first document in the query and updates it.
Finds the first document in the query and updates it .