@Override public DeleteResult deleteMany(Bson filter, DeleteOptions arg1) { OperationMetric metric = null; if (MongoLogger.GATHERER.isEnabled()) { List<String> keyValuePairs = MongoUtilities.getKeyValuePairs(filter); String operationName = "Mongo : " + getNamespace().getCollectionName() + " : deleteMany " + MongoUtilities.filterParameters(filter).toString(); metric = startMetric(operationName, keyValuePairs); addWriteConcern(metric); } DeleteResult retVal = collection.deleteMany(filter, arg1); stopMetric(metric, (int) retVal.getDeletedCount()); return retVal; }
@Override public DeleteResult deleteOne(Bson filter, DeleteOptions arg1) { OperationMetric metric = null; if (MongoLogger.GATHERER.isEnabled()) { List<String> keyValuePairs = MongoUtilities.getKeyValuePairs(filter); String operationName = "Mongo : " + getNamespace().getCollectionName() + " : deleteOne " + MongoUtilities.filterParameters(filter).toString(); metric = startMetric(operationName, keyValuePairs); addWriteConcern(metric); } DeleteResult retVal = collection.deleteOne(filter, arg1); stopMetric(metric, (int) retVal.getDeletedCount()); return retVal; }
@Test public void deleteMany() { coll.deleteMany(Filters.eq("name", "JUNK")); coll.deleteMany(Filters.eq("name", "JUNK"), new DeleteOptions()); coll.deleteOne(Filters.eq("name", "JUNK")); coll.deleteOne(Filters.eq("name", "JUNK"), new DeleteOptions()); }
@Override public Observable<DeleteResult> deleteOne(final Bson filter, final DeleteOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteOne(filter, options, callback); } }), observableAdapter); }
@Override public Observable<DeleteResult> deleteMany(final Bson filter, final DeleteOptions options) { return RxObservables.create(Observables.observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteMany(filter, options, callback); } }), observableAdapter); }
@Override public Publisher<DeleteResult> deleteOne(final Bson filter, final DeleteOptions options) { return new ObservableToPublisher<DeleteResult>(observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteOne(filter, options, callback); } })); }
@Override public Publisher<DeleteResult> deleteOne(final ClientSession clientSession, final Bson filter, final DeleteOptions options) { return new ObservableToPublisher<DeleteResult>(observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteOne(clientSession, filter, options, callback); } })); }
@Override public Publisher<DeleteResult> deleteMany(final Bson filter, final DeleteOptions options) { return new ObservableToPublisher<DeleteResult>(observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteMany(filter, options, callback); } })); }
@Override public Publisher<DeleteResult> deleteMany(final ClientSession clientSession, final Bson filter, final DeleteOptions options) { return new ObservableToPublisher<DeleteResult>(observe(new Block<SingleResultCallback<DeleteResult>>() { @Override public void apply(final SingleResultCallback<DeleteResult> callback) { wrapped.deleteMany(clientSession, filter, options, callback); } })); }
@Override public Publisher<DeleteResult> deleteOne(final Bson filter) { return deleteOne(filter, new DeleteOptions()); }
@Override public Publisher<DeleteResult> deleteOne(final ClientSession clientSession, final Bson filter) { return deleteOne(clientSession, filter, new DeleteOptions()); }
@Override public Publisher<DeleteResult> deleteMany(final Bson filter) { return deleteMany(filter, new DeleteOptions()); }
@Override public Publisher<DeleteResult> deleteMany(final ClientSession clientSession, final Bson filter) { return deleteMany(clientSession, filter, new DeleteOptions()); }
/** * Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not * modified. * * @param filter the query filter to apply the the delete operation * @param options the options to apply to the delete operation * @return an Observable with a single element the DeleteResult or with an com.mongodb.MongoException * @since 1.3 */ Observable<DeleteResult> deleteOne(Bson filter, DeleteOptions options);
/** * Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified. * * @param filter the query filter to apply the the delete operation * @param options the options to apply to the delete operation * @return an Observable with a single element the DeleteResult or with an com.mongodb.MongoException * @since 1.3 */ Observable<DeleteResult> deleteMany(Bson filter, DeleteOptions options);
/** * Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not * modified. * * @param filter the query filter to apply the the delete operation * @param options the options to apply to the delete operation * @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException * @since 1.5 */ Publisher<DeleteResult> deleteOne(Bson filter, DeleteOptions options);
/** * Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not * modified. * * @param clientSession the client session with which to associate this operation * @param filter the query filter to apply the the delete operation * @param options the options to apply to the delete operation * @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException * @mongodb.server.release 3.6 * @since 1.7 */ Publisher<DeleteResult> deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options);
/** * Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified. * * @param filter the query filter to apply the the delete operation * @param options the options to apply to the delete operation * @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException * @since 1.5 */ Publisher<DeleteResult> deleteMany(Bson filter, DeleteOptions options);
/** * Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified. * * @param clientSession the client session with which to associate this operation * @param filter the query filter to apply the the delete operation * @param options the options to apply to the delete operation * @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException * @mongodb.server.release 3.6 * @since 1.7 */ Publisher<DeleteResult> deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options);