类com.mongodb.client.model.DeleteOptions源码实例Demo

下面列出了怎么用com.mongodb.client.model.DeleteOptions的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: quarkus   文件: BasicInteractionTest.java
@Test
void testSingleDocumentDeletionWithOptions() {
    ReactiveMongoDatabase database = client.getDatabase(DATABASE);
    ReactiveMongoCollection<Document> collection = database.getCollection(randomAlphaString(8));

    List<Document> documents = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        documents.add(new Document("i", i));
    }
    collection.insertMany(documents).await().indefinitely();

    DeleteResult result = collection.deleteOne(eq("i", 10),
            new DeleteOptions().collation(
                    Collation.builder().locale("en").caseLevel(true).build()))
            .await().indefinitely();
    assertThat(result.getDeletedCount()).isEqualTo(1);
    assertThat(collection.find(eq("i", 10)).collectItems().first().await().indefinitely()).isNull();
    Long count = collection.countDocuments().await().indefinitely();
    assertThat(count).isEqualTo(99);
}
 
源代码2 项目: quarkus   文件: BasicInteractionTest.java
@Test
void testMultipleDocumentDeletionWithOptions() {
    ReactiveMongoDatabase database = client.getDatabase(DATABASE);
    ReactiveMongoCollection<Document> collection = database.getCollection(randomAlphaString(8));

    List<Document> documents = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        documents.add(new Document("i", i));
    }
    collection.insertMany(documents).await().indefinitely();

    DeleteResult result = collection.deleteMany(gte("i", 90), new DeleteOptions().collation(
            Collation.builder().locale("en").caseLevel(true).build()))
            .await().indefinitely();
    assertThat(result.getDeletedCount()).isEqualTo(10);
    assertThat(collection.find(eq("i", 90)).collectItems().first().await().asOptional().indefinitely()).isEmpty();
    Long count = collection.countDocuments().await().indefinitely();
    assertThat(count).isEqualTo(90);
}
 
@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>(com.mongodb.async.client.Observables.observe(
            new Block<com.mongodb.async.SingleResultCallback<DeleteResult>>() {
                @Override
                public void apply(final com.mongodb.async.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>(com.mongodb.async.client.Observables.observe(
            new Block<com.mongodb.async.SingleResultCallback<DeleteResult>>() {
                @Override
                public void apply(final com.mongodb.async.SingleResultCallback<DeleteResult> callback) {
                    wrapped.deleteOne(clientSession.getWrapped(), filter, options, callback);
                }
            }));
}
 
@Override
public Publisher<DeleteResult> deleteMany(final Bson filter, final DeleteOptions options) {
    return new ObservableToPublisher<DeleteResult>(com.mongodb.async.client.Observables.observe(
            new Block<com.mongodb.async.SingleResultCallback<DeleteResult>>() {
                @Override
                public void apply(final com.mongodb.async.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>(com.mongodb.async.client.Observables.observe(
            new Block<com.mongodb.async.SingleResultCallback<DeleteResult>>() {
                @Override
                public void apply(final com.mongodb.async.SingleResultCallback<DeleteResult> callback) {
                    wrapped.deleteMany(clientSession.getWrapped(), filter, options, callback);
                }
            }));
}
 
源代码9 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<DeleteResult> deleteOne(Bson filter, DeleteOptions options) {
    return Wrappers.toUni(collection.deleteOne(filter, options));
}
 
源代码10 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<DeleteResult> deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options) {
    return Wrappers.toUni(collection.deleteOne(clientSession, filter, options));
}
 
源代码11 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<DeleteResult> deleteMany(Bson filter, DeleteOptions options) {
    return Wrappers.toUni(collection.deleteMany(filter, options));
}
 
源代码12 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<DeleteResult> deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options) {
    return Wrappers.toUni(collection.deleteMany(clientSession, filter, options));
}
 
@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());
}
 
源代码17 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * 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 {@link Uni} receiving the {@link DeleteResult}, or propagating a {@link com.mongodb.MongoException} on
 *         failure.
 */
Uni<DeleteResult> deleteOne(Bson filter, DeleteOptions options);
 
源代码18 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * 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 {@link Uni} receiving the {@link DeleteResult}, or propagating a {@link com.mongodb.MongoException} on
 *         failure.
 */
Uni<DeleteResult> deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options);
 
源代码19 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * 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 {@link Uni} receiving the {@link DeleteResult}, or propagating a {@link com.mongodb.MongoException} on
 *         failure.
 */
Uni<DeleteResult> deleteMany(Bson filter, DeleteOptions options);
 
源代码20 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * 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 {@link Uni} receiving the {@link DeleteResult}, or propagating a {@link com.mongodb.MongoException} on
 *         failure.
 */
Uni<DeleteResult> deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options);
 
源代码21 项目: mongo-java-driver-rx   文件: MongoCollection.java
/**
 * 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);
 
源代码22 项目: mongo-java-driver-rx   文件: MongoCollection.java
/**
 * 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);
 
 类所在包
 类方法
 同包方法