private static FindOneAndDeleteOptions convertToFindOneAndDeleteOptions(Document fields, Document sort) { FindOneAndDeleteOptions result = new FindOneAndDeleteOptions(); result = result.projection(fields).sort(sort); return result; }
FindAndDeleteOperation<TDocument> findOneAndDelete(final Bson filter, final FindOneAndDeleteOptions options) { return new FindAndDeleteOperation<TDocument>(namespace, writeConcern, retryWrites, getCodec()) .filter(toBsonDocument(filter)) .projection(toBsonDocument(options.getProjection())) .sort(toBsonDocument(options.getSort())) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .collation(options.getCollation()); }
/** * 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); }
@Override @Nullable public TDocument findOneAndDelete(final Bson filter) { return findOneAndDelete(filter, new FindOneAndDeleteOptions()); }
theOne = collection.findOneAndDelete( query, new FindOneAndDeleteOptions().sort( sort ) .projection( fields ) .maxTime( 0, TimeUnit.MILLISECONDS ) );
@Override @Nullable public TDocument findOneAndDelete(final ClientSession clientSession, final Bson filter) { return findOneAndDelete(clientSession, filter, new FindOneAndDeleteOptions()); }
theOne = collection.findOneAndDelete( query, new FindOneAndDeleteOptions().sort( sort ) .projection( fields ) .maxTime( 0, TimeUnit.MILLISECONDS ) );
/** * 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); }
public Document doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException { FindOneAndDeleteOptions opts = new FindOneAndDeleteOptions().sort(sort).projection(fields); collation.map(Collation::toMongoCollation).ifPresent(opts::collation); return collection.findOneAndDelete(query, opts); } }
@Override public Publisher<TDocument> findOneAndDelete(final ClientSession clientSession, final Bson filter) { return findOneAndDelete(clientSession, filter, new FindOneAndDeleteOptions()); }
FindAndDeleteOperation<TDocument> findOneAndDelete(final Bson filter, final FindOneAndDeleteOptions options) { return new FindAndDeleteOperation<TDocument>(namespace, writeConcern, retryWrites, getCodec()) .filter(toBsonDocument(filter)) .projection(toBsonDocument(options.getProjection())) .sort(toBsonDocument(options.getSort())) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .collation(options.getCollation()); }
private static FindOneAndDeleteOptions convertToFindOneAndDeleteOptions(Document fields, Document sort) { FindOneAndDeleteOptions result = new FindOneAndDeleteOptions(); result = result.projection(fields).sort(sort); return result; }
@Override public Publisher<TDocument> findOneAndDelete(final Bson filter) { return findOneAndDelete(filter, new FindOneAndDeleteOptions()); }
public Document doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException { FindOneAndDeleteOptions opts = new FindOneAndDeleteOptions().sort(sort).projection(fields); collation.map(Collation::toMongoCollation).ifPresent(opts::collation); return collection.findOneAndDelete(query, opts); } }
@Override @Nullable public TDocument findOneAndDelete(final Bson filter) { return findOneAndDelete(filter, new FindOneAndDeleteOptions()); }
@Override @Nullable public TDocument findOneAndDelete(final ClientSession clientSession, final Bson filter) { return findOneAndDelete(clientSession, filter, new FindOneAndDeleteOptions()); }
@Override @Nullable public TDocument findOneAndDelete(final Bson filter) { return findOneAndDelete(filter, new FindOneAndDeleteOptions()); }
@Override @Nullable public TDocument findOneAndDelete(final ClientSession clientSession, final Bson filter) { return findOneAndDelete(clientSession, filter, new FindOneAndDeleteOptions()); }