Search in sources :

Example 1 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project spring-data-mongodb by spring-projects.

the class ReactivePerformanceTests method writingObjectsUsingPlainDriver.

private long writingObjectsUsingPlainDriver(int numberOfPersons, WriteConcern concern) {
    MongoCollection<Document> collection = mongo.getDatabase(DATABASE_NAME).getCollection("driver").withWriteConcern(concern);
    List<Person> persons = getPersonObjects(numberOfPersons);
    executeWatched(() -> persons.stream().map(it -> Mono.from(collection.insertOne(new Document(it.toDocument()))).block()));
    return watch.getLastTaskTimeMillis();
}
Also used : Document(org.bson.Document) SimpleReactiveMongoDatabaseFactory(org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory) java.util(java.util) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) PersistenceConstructor(org.springframework.data.annotation.PersistenceConstructor) MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) MongoClients(com.mongodb.reactivestreams.client.MongoClients) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) MongoConverter(org.springframework.data.mongodb.core.convert.MongoConverter) BasicDBList(com.mongodb.BasicDBList) MongoClient(com.mongodb.reactivestreams.client.MongoClient) ReactiveMongoOperations(org.springframework.data.mongodb.core.ReactiveMongoOperations) DbRefResolver(org.springframework.data.mongodb.core.convert.DbRefResolver) DbRefResolverCallback(org.springframework.data.mongodb.core.convert.DbRefResolverCallback) CreateCollectionOptions(com.mongodb.client.model.CreateCollectionOptions) MongoDatabase(com.mongodb.reactivestreams.client.MongoDatabase) DbRefProxyHandler(org.springframework.data.mongodb.core.convert.DbRefProxyHandler) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) Constants(org.springframework.core.Constants) ReactiveMongoRepository(org.springframework.data.mongodb.repository.ReactiveMongoRepository) Before(org.junit.Before) DecimalFormat(java.text.DecimalFormat) BasicDBObject(com.mongodb.BasicDBObject) Mono(reactor.core.publisher.Mono) Test(org.junit.Test) StopWatch(org.springframework.util.StopWatch) ReactiveMongoRepositoryFactory(org.springframework.data.mongodb.repository.support.ReactiveMongoRepositoryFactory) Collectors(java.util.stream.Collectors) Criteria(org.springframework.data.mongodb.core.query.Criteria) Query(org.springframework.data.mongodb.core.query.Query) Flux(reactor.core.publisher.Flux) MappingMongoConverter(org.springframework.data.mongodb.core.convert.MappingMongoConverter) DBRef(com.mongodb.DBRef) ObjectId(org.bson.types.ObjectId) ReactiveMongoTemplate(org.springframework.data.mongodb.core.ReactiveMongoTemplate) Pattern(java.util.regex.Pattern) WriteConcern(com.mongodb.WriteConcern) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) Document(org.bson.Document)

Example 2 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project immutables by immutables.

the class MongoSession method watch.

private <X> Publisher<WatchEvent<X>> watch(StandardOperations.Watch operation) {
    final MongoCollection<X> collection = (MongoCollection<X>) this.collection;
    if (operation.query().hasProjections()) {
        return Flowable.error(new UnsupportedOperationException("Projections are not yet supported with watch operation"));
    }
    ChangeStreamPublisher<X> watch;
    if (!operation.query().filter().isPresent()) {
        // watch without filter
        watch = collection.watch(collection.getDocumentClass());
    } else {
        // prefix all attributes with 'fullDocument.'
        PathNaming naming = path -> "fullDocument." + this.pathNaming.name(path);
        // reuse aggregation pipeline
        AggregationQuery agg = new AggregationQuery(operation.query(), naming);
        watch = collection.watch(agg.toPipeline(), collection.getDocumentClass());
    }
    return Flowable.fromPublisher(watch.fullDocument(FullDocument.UPDATE_LOOKUP)).map(MongoWatchEvent::fromChangeStream);
}
Also used : Document(org.bson.Document) Iterables(com.google.common.collect.Iterables) ReplaceOneModel(com.mongodb.client.model.ReplaceOneModel) Path(org.immutables.criteria.expression.Path) PathNaming(org.immutables.criteria.backend.PathNaming) Projections(com.mongodb.client.model.Projections) StandardOperations(org.immutables.criteria.backend.StandardOperations) ReplaceOptions(com.mongodb.client.model.ReplaceOptions) BsonDocumentWriter(org.bson.BsonDocumentWriter) DefaultResult(org.immutables.criteria.backend.DefaultResult) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) CodecRegistry(org.bson.codecs.configuration.CodecRegistry) ExpressionNaming(org.immutables.criteria.backend.ExpressionNaming) Backend(org.immutables.criteria.backend.Backend) Function(java.util.function.Function) FlowableTransformer(io.reactivex.FlowableTransformer) BsonDocument(org.bson.BsonDocument) BsonValue(org.bson.BsonValue) Query(org.immutables.criteria.expression.Query) Level(java.util.logging.Level) FullDocument(com.mongodb.client.model.changestream.FullDocument) Bson(org.bson.conversions.Bson) ChangeStreamPublisher(com.mongodb.reactivestreams.client.ChangeStreamPublisher) Flowable(io.reactivex.Flowable) EncoderContext(org.bson.codecs.EncoderContext) WatchEvent(org.immutables.criteria.backend.WatchEvent) ProjectedTuple(org.immutables.criteria.backend.ProjectedTuple) Collation(org.immutables.criteria.expression.Collation) ExpressionConverter(org.immutables.criteria.expression.ExpressionConverter) MongoException(com.mongodb.MongoException) Publisher(org.reactivestreams.Publisher) CodecRegistries(org.bson.codecs.configuration.CodecRegistries) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) KeyExtractor(org.immutables.criteria.backend.KeyExtractor) Visitors(org.immutables.criteria.expression.Visitors) List(java.util.List) Sorts(com.mongodb.client.model.Sorts) BulkWriteResult(com.mongodb.bulk.BulkWriteResult) UniqueCachedNaming(org.immutables.criteria.backend.UniqueCachedNaming) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) Codec(org.bson.codecs.Codec) WriteResult(org.immutables.criteria.backend.WriteResult) Optional(java.util.Optional) BackendException(org.immutables.criteria.backend.BackendException) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) PathNaming(org.immutables.criteria.backend.PathNaming)

Example 3 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project immutables by immutables.

the class MongoSession method update.

/**
 * Uses <a href="https://docs.mongodb.com/manual/reference/method/db.collection.replaceOne/">replaceOne</a> operation
 * with <a href="https://docs.mongodb.com/manual/reference/method/db.collection.bulkWrite/">bulkWrite</a>. Right now has to convert
 * object to BsonDocument to extract {@code _id} attribute.
 */
private <T> Publisher<WriteResult> update(StandardOperations.Update operation) {
    ReplaceOptions options = new ReplaceOptions();
    if (operation.upsert()) {
        options.upsert(operation.upsert());
    }
    List<ReplaceOneModel<Object>> docs = operation.values().stream().map(value -> new ReplaceOneModel<>(new BsonDocument(Mongos.ID_FIELD_NAME, toBsonValue(keyExtractor.extract(value))), value, options)).collect(Collectors.toList());
    Publisher<BulkWriteResult> publisher = ((MongoCollection<Object>) collection).bulkWrite(docs);
    return Flowable.fromPublisher(publisher).map(x -> WriteResult.unknown());
}
Also used : Document(org.bson.Document) Iterables(com.google.common.collect.Iterables) ReplaceOneModel(com.mongodb.client.model.ReplaceOneModel) Path(org.immutables.criteria.expression.Path) PathNaming(org.immutables.criteria.backend.PathNaming) Projections(com.mongodb.client.model.Projections) StandardOperations(org.immutables.criteria.backend.StandardOperations) ReplaceOptions(com.mongodb.client.model.ReplaceOptions) BsonDocumentWriter(org.bson.BsonDocumentWriter) DefaultResult(org.immutables.criteria.backend.DefaultResult) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) CodecRegistry(org.bson.codecs.configuration.CodecRegistry) ExpressionNaming(org.immutables.criteria.backend.ExpressionNaming) Backend(org.immutables.criteria.backend.Backend) Function(java.util.function.Function) FlowableTransformer(io.reactivex.FlowableTransformer) BsonDocument(org.bson.BsonDocument) BsonValue(org.bson.BsonValue) Query(org.immutables.criteria.expression.Query) Level(java.util.logging.Level) FullDocument(com.mongodb.client.model.changestream.FullDocument) Bson(org.bson.conversions.Bson) ChangeStreamPublisher(com.mongodb.reactivestreams.client.ChangeStreamPublisher) Flowable(io.reactivex.Flowable) EncoderContext(org.bson.codecs.EncoderContext) WatchEvent(org.immutables.criteria.backend.WatchEvent) ProjectedTuple(org.immutables.criteria.backend.ProjectedTuple) Collation(org.immutables.criteria.expression.Collation) ExpressionConverter(org.immutables.criteria.expression.ExpressionConverter) MongoException(com.mongodb.MongoException) Publisher(org.reactivestreams.Publisher) CodecRegistries(org.bson.codecs.configuration.CodecRegistries) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) KeyExtractor(org.immutables.criteria.backend.KeyExtractor) Visitors(org.immutables.criteria.expression.Visitors) List(java.util.List) Sorts(com.mongodb.client.model.Sorts) BulkWriteResult(com.mongodb.bulk.BulkWriteResult) UniqueCachedNaming(org.immutables.criteria.backend.UniqueCachedNaming) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) Codec(org.bson.codecs.Codec) WriteResult(org.immutables.criteria.backend.WriteResult) Optional(java.util.Optional) BackendException(org.immutables.criteria.backend.BackendException) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) BsonDocument(org.bson.BsonDocument) ReplaceOneModel(com.mongodb.client.model.ReplaceOneModel) ReplaceOptions(com.mongodb.client.model.ReplaceOptions) BulkWriteResult(com.mongodb.bulk.BulkWriteResult)

Example 4 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project immutables by immutables.

the class IdAttributeTest method idAttribute.

/**
 * Test that {@code _id} attribute is persisted instead of {@code id}
 */
@Test
void idAttribute() {
    StringHolderRepository repository = new StringHolderRepository(resource.backend());
    ImmutableStringHolder holder = TypeHolder.StringHolder.generator().get().withId("id1");
    repository.insertAll(Arrays.asList(holder, holder.withId("id2")));
    MongoCollection<BsonDocument> collection = resource.collection(TypeHolder.StringHolder.class).withDocumentClass(BsonDocument.class);
    List<BsonDocument> docs = Flowable.fromPublisher(collection.find()).toList().blockingGet();
    Checkers.check(docs).hasSize(2);
    // has _id attribute
    Checkers.check(docs.stream().map(BsonDocument::keySet).flatMap(Collection::stream).collect(Collectors.toSet())).has("_id");
    // does not have 'id' attribute only '_id' (with underscore which is mongo specific) in collected documents
    Checkers.check(docs.stream().map(BsonDocument::keySet).flatMap(Collection::stream).collect(Collectors.toSet())).not().has("id");
    Checkers.check(docs.stream().map(d -> d.get("_id").asString().getValue()).collect(Collectors.toList())).hasContentInAnyOrder("id1", "id2");
    // using repository
    Checkers.check(repository.findAll().fetch().stream().map(TypeHolder.StringHolder::id).collect(Collectors.toList())).hasContentInAnyOrder("id1", "id2");
}
Also used : Arrays(java.util.Arrays) Checkers(org.immutables.check.Checkers) TypeHolder(org.immutables.criteria.typemodel.TypeHolder) Collection(java.util.Collection) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) ImmutableStringHolder(org.immutables.criteria.typemodel.ImmutableStringHolder) Collectors(java.util.stream.Collectors) BsonDocument(org.bson.BsonDocument) Test(org.junit.jupiter.api.Test) StringHolderRepository(org.immutables.criteria.typemodel.StringHolderRepository) List(java.util.List) MongoDatabase(com.mongodb.reactivestreams.client.MongoDatabase) Flowable(io.reactivex.Flowable) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) TypeHolder(org.immutables.criteria.typemodel.TypeHolder) StringHolderRepository(org.immutables.criteria.typemodel.StringHolderRepository) ImmutableStringHolder(org.immutables.criteria.typemodel.ImmutableStringHolder) ImmutableStringHolder(org.immutables.criteria.typemodel.ImmutableStringHolder) BsonDocument(org.bson.BsonDocument) Collection(java.util.Collection) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) Test(org.junit.jupiter.api.Test)

Example 5 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project spring-data-mongodb by spring-projects.

the class ReactiveMongoTemplate method doUpdate.

protected Mono<UpdateResult> doUpdate(final String collectionName, @Nullable Query query, @Nullable Update update, @Nullable Class<?> entityClass, final boolean upsert, final boolean multi) {
    MongoPersistentEntity<?> entity = entityClass == null ? null : getPersistentEntity(entityClass);
    Flux<UpdateResult> result = execute(collectionName, collection -> {
        increaseVersionForUpdateIfNecessary(entity, update);
        Document queryObj = query == null ? new Document() : queryMapper.getMappedObject(query.getQueryObject(), entity);
        Document updateObj = update == null ? new Document() : updateMapper.getMappedObject(update.getUpdateObject(), entity);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(String.format("Calling update using query: %s and update: %s in collection: %s", serializeToJsonSafely(queryObj), serializeToJsonSafely(updateObj), collectionName));
        }
        MongoAction mongoAction = new MongoAction(writeConcern, MongoActionOperation.UPDATE, collectionName, entityClass, updateObj, queryObj);
        WriteConcern writeConcernToUse = prepareWriteConcern(mongoAction);
        MongoCollection<Document> collectionToUse = prepareCollection(collection, writeConcernToUse);
        UpdateOptions updateOptions = new UpdateOptions().upsert(upsert);
        query.getCollation().map(Collation::toMongoCollation).ifPresent(updateOptions::collation);
        if (!UpdateMapper.isUpdateObject(updateObj)) {
            return collectionToUse.replaceOne(queryObj, updateObj, updateOptions);
        }
        if (multi) {
            return collectionToUse.updateMany(queryObj, updateObj, updateOptions);
        }
        return collectionToUse.updateOne(queryObj, updateObj, updateOptions);
    }).doOnNext(updateResult -> {
        if (entity != null && entity.hasVersionProperty() && !multi) {
            if (updateResult.wasAcknowledged() && updateResult.getMatchedCount() == 0) {
                Document queryObj = query == null ? new Document() : queryMapper.getMappedObject(query.getQueryObject(), entity);
                Document updateObj = update == null ? new Document() : updateMapper.getMappedObject(update.getUpdateObject(), entity);
                if (dbObjectContainsVersionProperty(queryObj, entity))
                    throw new OptimisticLockingFailureException("Optimistic lock exception on saving entity: " + updateObj.toString() + " to collection " + collectionName);
            }
        }
    });
    return result.next();
}
Also used : Document(org.bson.Document) PropertyReferenceException(org.springframework.data.mapping.PropertyReferenceException) DeleteOptions(com.mongodb.client.model.DeleteOptions) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) PersistentPropertyAccessor(org.springframework.data.mapping.PersistentPropertyAccessor) ClientSession(com.mongodb.session.ClientSession) FullDocument(com.mongodb.client.model.changestream.FullDocument) Optionals(org.springframework.data.util.Optionals) UpdateResult(com.mongodb.client.result.UpdateResult) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) UpdateOptions(com.mongodb.client.model.UpdateOptions) AggregationOperationContext(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext) ClassUtils(org.springframework.util.ClassUtils) NonNull(lombok.NonNull) NearQuery(org.springframework.data.mongodb.core.query.NearQuery) Aggregation(org.springframework.data.mongodb.core.aggregation.Aggregation) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) PropertyPath(org.springframework.data.mapping.PropertyPath) Id(org.springframework.data.annotation.Id) SpelAwareProxyProjectionFactory(org.springframework.data.projection.SpelAwareProxyProjectionFactory) ApplicationContextAware(org.springframework.context.ApplicationContextAware) AfterDeleteEvent(org.springframework.data.mongodb.core.mapping.event.AfterDeleteEvent) java.util(java.util) Validator(org.springframework.data.mongodb.core.validation.Validator) MappingContext(org.springframework.data.mapping.context.MappingContext) FindOneAndUpdateOptions(com.mongodb.client.model.FindOneAndUpdateOptions) CountOptions(com.mongodb.client.model.CountOptions) MongoClient(com.mongodb.reactivestreams.client.MongoClient) Bson(org.bson.conversions.Bson) Filters(com.mongodb.client.model.Filters) ProjectionInformation(org.springframework.data.projection.ProjectionInformation) MappingException(org.springframework.data.mapping.MappingException) CreateCollectionOptions(com.mongodb.client.model.CreateCollectionOptions) MongoDatabase(com.mongodb.reactivestreams.client.MongoDatabase) ConvertingPropertyAccessor(org.springframework.data.mapping.model.ConvertingPropertyAccessor) Nullable(org.springframework.lang.Nullable) MongoSimpleTypes(org.springframework.data.mongodb.core.mapping.MongoSimpleTypes) Success(com.mongodb.reactivestreams.client.Success) ConversionService(org.springframework.core.convert.ConversionService) BeforeConvertEvent(org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent) PrefixingDelegatingAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.PrefixingDelegatingAggregationOperationContext) AfterConvertEvent(org.springframework.data.mongodb.core.mapping.event.AfterConvertEvent) BeforeSaveEvent(org.springframework.data.mongodb.core.mapping.event.BeforeSaveEvent) ReactiveIndexOperations(org.springframework.data.mongodb.core.index.ReactiveIndexOperations) Publisher(org.reactivestreams.Publisher) ObjectUtils(org.springframework.util.ObjectUtils) TypedAggregation(org.springframework.data.mongodb.core.aggregation.TypedAggregation) Mono(reactor.core.publisher.Mono) BeansException(org.springframework.beans.BeansException) MongoMappingEventPublisher(org.springframework.data.mongodb.core.index.MongoMappingEventPublisher) Criteria(org.springframework.data.mongodb.core.query.Criteria) Flux(reactor.core.publisher.Flux) ObjectId(org.bson.types.ObjectId) MongoMappingEvent(org.springframework.data.mongodb.core.mapping.event.MongoMappingEvent) org.springframework.data.mongodb.core.convert(org.springframework.data.mongodb.core.convert) JSONParseException(com.mongodb.util.JSONParseException) RequiredArgsConstructor(lombok.RequiredArgsConstructor) LoggerFactory(org.slf4j.LoggerFactory) Collation(org.springframework.data.mongodb.core.query.Collation) MongoClientVersion(org.springframework.data.mongodb.util.MongoClientVersion) BeforeDeleteEvent(org.springframework.data.mongodb.core.mapping.event.BeforeDeleteEvent) BsonValue(org.bson.BsonValue) PersistenceExceptionTranslator(org.springframework.dao.support.PersistenceExceptionTranslator) OptimisticLockingFailureException(org.springframework.dao.OptimisticLockingFailureException) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) com.mongodb(com.mongodb) Pair(org.springframework.data.util.Pair) Update(org.springframework.data.mongodb.core.query.Update) MongoPersistentEntityIndexCreator(org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator) SerializationUtils(org.springframework.data.mongodb.core.query.SerializationUtils) ReturnDocument(com.mongodb.client.model.ReturnDocument) ApplicationListener(org.springframework.context.ApplicationListener) Collectors(java.util.stream.Collectors) Entry(java.util.Map.Entry) Codec(org.bson.codecs.Codec) ReactiveMongoDatabaseFactory(org.springframework.data.mongodb.ReactiveMongoDatabaseFactory) TypeBasedAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.TypeBasedAggregationOperationContext) Metric(org.springframework.data.geo.Metric) DataAccessException(org.springframework.dao.DataAccessException) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) Tuple2(reactor.util.function.Tuple2) InvalidDataAccessApiUsageException(org.springframework.dao.InvalidDataAccessApiUsageException) DistinctPublisher(com.mongodb.reactivestreams.client.DistinctPublisher) Function(java.util.function.Function) Distance(org.springframework.data.geo.Distance) EntityReader(org.springframework.data.convert.EntityReader) AfterLoadEvent(org.springframework.data.mongodb.core.mapping.event.AfterLoadEvent) FindOneAndDeleteOptions(com.mongodb.client.model.FindOneAndDeleteOptions) ChangeStreamPublisher(com.mongodb.reactivestreams.client.ChangeStreamPublisher) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) ValidationOptions(com.mongodb.client.model.ValidationOptions) Nonnull(javax.annotation.Nonnull) ApplicationEventPublisherAware(org.springframework.context.ApplicationEventPublisherAware) Logger(org.slf4j.Logger) AggregationOptions(org.springframework.data.mongodb.core.aggregation.AggregationOptions) IndexOperationsAdapter(org.springframework.data.mongodb.core.index.IndexOperationsAdapter) ApplicationContext(org.springframework.context.ApplicationContext) Query(org.springframework.data.mongodb.core.query.Query) Consumer(java.util.function.Consumer) AfterSaveEvent(org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent) AggregatePublisher(com.mongodb.reactivestreams.client.AggregatePublisher) DeleteResult(com.mongodb.client.result.DeleteResult) GeoResult(org.springframework.data.geo.GeoResult) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) OptimisticLockingFailureException(org.springframework.dao.OptimisticLockingFailureException) Document(org.bson.Document) FullDocument(com.mongodb.client.model.changestream.FullDocument) ReturnDocument(com.mongodb.client.model.ReturnDocument) Collation(org.springframework.data.mongodb.core.query.Collation) UpdateResult(com.mongodb.client.result.UpdateResult) UpdateOptions(com.mongodb.client.model.UpdateOptions) FindOneAndUpdateOptions(com.mongodb.client.model.FindOneAndUpdateOptions)

Aggregations

MongoCollection (com.mongodb.reactivestreams.client.MongoCollection)10 Document (org.bson.Document)9 FindPublisher (com.mongodb.reactivestreams.client.FindPublisher)8 Collectors (java.util.stream.Collectors)8 BsonValue (org.bson.BsonValue)8 Function (java.util.function.Function)6 BsonDocument (org.bson.BsonDocument)6 Bson (org.bson.conversions.Bson)6 Publisher (org.reactivestreams.Publisher)6 FullDocument (com.mongodb.client.model.changestream.FullDocument)5 ChangeStreamPublisher (com.mongodb.reactivestreams.client.ChangeStreamPublisher)5 Codec (org.bson.codecs.Codec)5 Mono (reactor.core.publisher.Mono)5 DeleteResult (com.mongodb.client.result.DeleteResult)4 MongoDatabase (com.mongodb.reactivestreams.client.MongoDatabase)4 UpdateResult (com.mongodb.client.result.UpdateResult)3 MongoClient (com.mongodb.reactivestreams.client.MongoClient)3 Flowable (io.reactivex.Flowable)3 List (java.util.List)3 Consumer (java.util.function.Consumer)3