List of usage examples for com.mongodb.async.client MongoCollection findOneAndDelete
void findOneAndDelete(ClientSession clientSession, Bson filter, SingleResultCallback<TDocument> callback);
From source file:io.vertx.ext.mongo.impl.MongoClientImpl.java
License:Open Source License
@Override public io.vertx.ext.mongo.MongoClient findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions, Handler<AsyncResult<JsonObject>> resultHandler) { requireNonNull(collection, "collection cannot be null"); requireNonNull(query, "query cannot be null"); requireNonNull(findOptions, "find options cannot be null"); requireNonNull(resultHandler, "resultHandler cannot be null"); JsonObject encodedQuery = encodeKeyWhenUseObjectId(query); Bson bquery = wrap(encodedQuery);//from w ww . ja va2 s. co m FindOneAndDeleteOptions foadOptions = new FindOneAndDeleteOptions(); foadOptions.sort(wrap(findOptions.getSort())); foadOptions.projection(wrap(findOptions.getFields())); MongoCollection<JsonObject> coll = getCollection(collection); coll.findOneAndDelete(bquery, foadOptions, wrapCallback(resultHandler)); return this; }