Java 类com.mongodb.client.model.FindOneAndDeleteOptions 实例源码
项目:ibm-performance-monitor
文件:ProfiledMongoCollection.java
@Override
public TDocument findOneAndDelete(Bson filter, FindOneAndDeleteOptions arg1)
{
OperationMetric metric = null;
if (MongoLogger.GATHERER.isEnabled())
{
List<String> keyValuePairs = MongoUtilities.getKeyValuePairs(filter);
String operationName = "Mongo : " + getNamespace().getCollectionName() + " : findOneAndDelete " +
MongoUtilities.filterParameters(filter).toString();
metric = startMetric(operationName, keyValuePairs);
addWriteConcern(metric);
addReadConcernAndPreference(metric);
}
TDocument retVal = collection.findOneAndDelete(filter, arg1);
stopMetric(metric, measureDocumentSizeIfResultSizeEnabled(retVal));
return retVal;
}
项目:vertx-mongo-client
文件:MongoClientImpl.java
@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);
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;
}
项目:GitHub
文件:Repositories.java
protected final FluentFuture<Optional<T>> doFindOneAndDelete(
final Constraints.ConstraintHost criteria,
final FindOneAndDeleteOptions options) {
checkNotNull(criteria, "criteria");
checkNotNull(options, "options");
return submit(new Callable<Optional<T>>() {
@Override
public Optional<T> call() throws Exception {
@Nullable T result = collection().findOneAndDelete(convertToBson(criteria), options);
return Optional.fromNullable(result);
}
});
}
项目:GitHub
文件:Repositories.java
/**
* Deletes and returns first matching document. Returns {@link Optional#absent()} if none
* documents matches.
* @return future of optional matching deleted document.
*/
public FluentFuture<Optional<T>> deleteFirst() {
checkState(numberToSkip == 0, "Cannot use .skip() with .deleteFirst()");
FindOneAndDeleteOptions options = new FindOneAndDeleteOptions();
options.sort(convertToBson(ordering));
return repository.doFindOneAndDelete(criteria, options);
}
项目:ibm-performance-monitor
文件:ProfiledMongoClientTest.java
@Test
public void findOneAndDelete()
{
insertOneWithBulk();
Assert.assertNotNull(coll.findOneAndDelete(Filters.eq("name", "DELETEME")));
insertOneWithBulk();
Assert.assertNotNull(coll.findOneAndDelete(Filters.eq("name", "DELETEME"), new FindOneAndDeleteOptions()));
}
项目:mongo-java-driver-rx
文件:MongoCollectionImpl.java
@Override
public Observable<TDocument> findOneAndDelete(final Bson filter, final FindOneAndDeleteOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<TDocument>>() {
@Override
public void apply(final SingleResultCallback<TDocument> callback) {
wrapped.findOneAndDelete(filter, options, callback);
}
}), observableAdapter);
}
项目:mongo-java-driver-reactivestreams
文件:MongoCollectionImpl.java
@Override
public Publisher<TDocument> findOneAndDelete(final Bson filter, final FindOneAndDeleteOptions options) {
return new ObservableToPublisher<TDocument>(observe(new Block<SingleResultCallback<TDocument>>() {
@Override
public void apply(final SingleResultCallback<TDocument> callback) {
wrapped.findOneAndDelete(filter, options, callback);
}
}));
}
项目:mongo-java-driver-reactivestreams
文件:MongoCollectionImpl.java
@Override
public Publisher<TDocument> findOneAndDelete(final ClientSession clientSession, final Bson filter,
final FindOneAndDeleteOptions options) {
return new ObservableToPublisher<TDocument>(observe(new Block<SingleResultCallback<TDocument>>() {
@Override
public void apply(final SingleResultCallback<TDocument> callback) {
wrapped.findOneAndDelete(clientSession, filter, options, callback);
}
}));
}
项目:immutables
文件:Repositories.java
protected final FluentFuture<Optional<T>> doFindOneAndDelete(
final Constraints.ConstraintHost criteria,
final FindOneAndDeleteOptions options) {
checkNotNull(criteria, "criteria");
checkNotNull(options, "options");
return submit(new Callable<Optional<T>>() {
@Override
public Optional<T> call() throws Exception {
@Nullable T result = collection().findOneAndDelete(convertToBson(criteria), options);
return Optional.fromNullable(result);
}
});
}
项目:immutables
文件:Repositories.java
/**
* Deletes and returns first matching document. Returns {@link Optional#absent()} if none
* documents matches.
* @return future of optional matching deleted document.
*/
public FluentFuture<Optional<T>> deleteFirst() {
checkState(numberToSkip == 0, "Cannot use .skip() with .deleteFirst()");
FindOneAndDeleteOptions options = new FindOneAndDeleteOptions();
options.sort(convertToBson(ordering));
return repository.doFindOneAndDelete(criteria, options);
}
项目:mongo-java-driver-rx
文件:MongoCollectionImpl.java
@Override
public Observable<TDocument> findOneAndDelete(final Bson filter) {
return findOneAndDelete(filter, new FindOneAndDeleteOptions());
}
项目:mongo-java-driver-reactivestreams
文件:MongoCollectionImpl.java
@Override
public Publisher<TDocument> findOneAndDelete(final Bson filter) {
return findOneAndDelete(filter, new FindOneAndDeleteOptions());
}
项目:mongo-java-driver-reactivestreams
文件:MongoCollectionImpl.java
@Override
public Publisher<TDocument> findOneAndDelete(final ClientSession clientSession, final Bson filter) {
return findOneAndDelete(clientSession, filter, new FindOneAndDeleteOptions());
}
项目:mongo-java-driver-rx
文件:MongoCollection.java
/**
* Atomically find a document and remove it.
*
* @param filter the query filter to find the document with
* @param options the options to apply to the operation
* @return an Observable with a single element the document that was removed. If no documents matched the query filter, then the
* observer will complete without emitting any items
*/
Observable<TDocument> findOneAndDelete(Bson filter, FindOneAndDeleteOptions options);
项目:mongo-java-driver-reactivestreams
文件:MongoCollection.java
/**
* Atomically find a document and remove it.
*
* @param filter the query filter to find the document with
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be
* returned
*/
Publisher<TDocument> findOneAndDelete(Bson filter, FindOneAndDeleteOptions options);
项目:mongo-java-driver-reactivestreams
文件:MongoCollection.java
/**
* Atomically find a document and remove it.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to find the document with
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be
* returned
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher<TDocument> findOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options);