@Override protected List<? extends WriteRequest> getWriteRequests() { return getDeleteRequests(); }
/** * Remove documents from a collection. * * @param query the deletion criteria using query operators. Omit the query parameter or pass an empty document to delete all * documents in the collection. * @param options the options to apply to the delete operation * @return the result of the operation * @throws com.mongodb.WriteConcernException if the write failed due some other failure specific to the delete command * @throws MongoException if the operation failed for some other reason * @mongodb.driver.manual tutorial/remove-documents/ Remove Documents * @since 3.4 */ public WriteResult remove(final DBObject query, final DBCollectionRemoveOptions options) { notNull("query", query); notNull("options", options); WriteConcern writeConcern = options.getWriteConcern() != null ? options.getWriteConcern() : getWriteConcern(); DeleteRequest deleteRequest = new DeleteRequest(wrap(query, options.getEncoder())).collation(options.getCollation()); return executeWriteOperation(new DeleteOperation(getNamespace(), false, writeConcern, retryWrites, singletonList(deleteRequest))); }
/** * Remove documents from a collection. * * @param query the deletion criteria using query operators. Omit the query parameter or pass an empty document to delete all * documents in the collection. * @param options the options to apply to the delete operation * @return the result of the operation * @throws com.mongodb.WriteConcernException if the write failed due some other failure specific to the delete command * @throws MongoException if the operation failed for some other reason * @mongodb.driver.manual tutorial/remove-documents/ Remove Documents * @since 3.4 */ public WriteResult remove(final DBObject query, final DBCollectionRemoveOptions options) { notNull("query", query); notNull("options", options); WriteConcern writeConcern = options.getWriteConcern() != null ? options.getWriteConcern() : getWriteConcern(); DeleteRequest deleteRequest = new DeleteRequest(wrap(query, options.getEncoder())).collation(options.getCollation()); return executeWriteOperation(new DeleteOperation(getNamespace(), false, writeConcern, retryWrites, singletonList(deleteRequest))); }
@Override protected List<? extends WriteRequest> getWriteRequests() { return getDeleteRequests(); }