List of usage examples for com.mongodb.async.client MongoCollection updateOne
void updateOne(ClientSession clientSession, Bson filter, List<? extends Bson> update, SingleResultCallback<UpdateResult> callback);
From source file:io.vertx.ext.mongo.impl.MongoClientImpl.java
License:Open Source License
@Override public io.vertx.ext.mongo.MongoClient updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler) { requireNonNull(collection, "collection cannot be null"); requireNonNull(query, "query cannot be null"); requireNonNull(update, "update cannot be null"); requireNonNull(options, "options cannot be null"); requireNonNull(resultHandler, "resultHandler cannot be null"); MongoCollection<JsonObject> coll = getCollection(collection, options.getWriteOption()); Bson bquery = wrap(encodeKeyWhenUseObjectId(query)); Bson bupdate = wrap(encodeKeyWhenUseObjectId(update)); if (options.isMulti()) { coll.updateMany(bquery, bupdate, mongoUpdateOptions(options), toMongoClientUpdateResult(resultHandler)); } else {//from ww w .j av a 2s.com coll.updateOne(bquery, bupdate, mongoUpdateOptions(options), toMongoClientUpdateResult(resultHandler)); } return this; }