src/main/java/org/mongojack/JacksonMongoCollection.java
/**
     * Saves an object to this collection (does insert or update based on the
     * object _id).
     * 
     * @param object
     *            the <code>DBObject</code> to save
     * @param concern
     *            the write concern
     * @return The UpdateResult result
     * @throws MongoWriteException
     *             If the write failed due some other failure specific to the delete command
     * @throws MongoWriteConcernException
     *             If the write failed due being unable to fulfill the write concern
     * @throws MongoException
     *             If an error occurred
     */
Saves an object to this collection (does insert or update based on the
object _id).


Saves an object to this collection ( does insert or update based on the object _id ) .
public UpdateResult save(T object, WriteConcern concern) throws MongoWriteException, MongoWriteConcernException, MongoException {
        Document dbObject = convertToDocument(object);
        Object _id = dbObject.get("_id");
        if(_id == null) {
            this.insert(object, concern);
            return UpdateResult.acknowledged(0, 1L, new BsonObjectId((ObjectId) convertToDocument(object).get("_id")));
        } else {
            return this.replaceOne(new Document("_id", _id), object, true, concern);
        }
    }
public UpdateResult save ( T object , WriteConcern concern ) throws MongoWriteException , MongoWriteConcernException , MongoException { Document dbObject = convertToDocument ( object ) ; Object _id = dbObject . get ( "_id" ) ; if ( _id == null ) { this . insert ( object , concern ) ; return UpdateResult . acknowledged ( 0 , 1L , new BsonObjectId ( ( ObjectId ) convertToDocument ( object ) . get ( "_id" ) ) ) ; } else { return this . replaceOne ( new Document ( "_id" , _id ) , object , true , concern ) ; } }
Saves an object to this collection (does insert or update based on the
 object _id).
Saves an object to this collection ( does insert or update based on the object _id ) .