public void insert(Document document, QueryOptions options) {
        int writeConcern = 1;
        int ms = 0;
        if (options != null && (options.containsKey("w") || options.containsKey("wtimeout"))) {
            // Some info about params: http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html
//            return dbCollection.insert(dbObject, new WriteConcern(options.getInt("w", 1), options.getInt("wtimeout", 0)));
            writeConcern = options.getInt("w", 1);
            ms = options.getInt("wtimeout", 0);
        }
        dbCollection.withWriteConcern(new WriteConcern(writeConcern, ms));
        dbCollection.insertOne(document);
    }
public void insert ( Document document , QueryOptions options ) { int writeConcern = 1 ; int ms = 0 ; if ( options != null && ( options . containsKey ( "w" ) || options . containsKey ( "wtimeout" ) ) ) { writeConcern = options . getInt ( "w" , 1 ) ; ms = options . getInt ( "wtimeout" , 0 ) ; } dbCollection . withWriteConcern ( new WriteConcern ( writeConcern , ms ) ) ; dbCollection . insertOne ( document ) ; }
This method insert a single document into a collection. Params w and wtimeout are read from QueryOptions.

@param document The new document to be inserted
@param options  Some options like timeout