Search in sources :

Example 6 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) BeforeEach(org.junit.jupiter.api.BeforeEach) java.util(java.util) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) ReferenceLoader(org.springframework.data.mongodb.core.convert.ReferenceLoader) 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) ReferenceLookupDelegate(org.springframework.data.mongodb.core.convert.ReferenceLookupDelegate) 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) Nullable(org.springframework.lang.Nullable) ReactiveMongoRepository(org.springframework.data.mongodb.repository.ReactiveMongoRepository) DecimalFormat(java.text.DecimalFormat) BasicDBObject(com.mongodb.BasicDBObject) Mono(reactor.core.publisher.Mono) 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) Test(org.junit.jupiter.api.Test) 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 7 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)

Example 8 with MongoCollection

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

the class MongoSession method query.

private Publisher<?> query(StandardOperations.Select select) {
    final Query query = select.query();
    final boolean hasProjections = query.hasProjections();
    boolean useAggregationPipeline = query.hasAggregations() || query.distinct() || query.count() && query.limit().isPresent();
    ExpressionNaming expressionNaming = useAggregationPipeline ? ExpressionNaming.from(UniqueCachedNaming.of(query.projections())) : expression -> pathNaming.name((Path) expression);
    MongoCollection<?> collection = this.collection;
    if (hasProjections) {
        // add special TupleCodecProvider for projections
        CodecRegistry newRegistry = CodecRegistries.fromRegistries(this.collection.getCodecRegistry(), CodecRegistries.fromProviders(new TupleCodecProvider(query, expressionNaming)));
        collection = this.collection.withDocumentClass(ProjectedTuple.class).withCodecRegistry(newRegistry);
    }
    if (useAggregationPipeline) {
        // aggregations
        AggregationQuery agg = new AggregationQuery(query, pathNaming);
        if (query.count()) {
            // also for empty result-set mongo does not return single(0) but empty publisher
            return Flowable.fromPublisher(collection.aggregate(agg.toPipeline(), BsonDocument.class)).map(d -> d.get("count").asNumber().longValue()).defaultIfEmpty(// return Single.just(0) for empty publisher
            0L);
        }
        return collection.aggregate(agg.toPipeline(), ProjectedTuple.class);
    }
    Bson filter = toBsonFilter(query);
    if (query.count()) {
        // simple form of count all (without distinct, aggregations etc.) : count(*)
        return Flowable.fromPublisher(collection.countDocuments(filter));
    }
    final FindPublisher<?> find = collection.find(filter);
    if (!query.collations().isEmpty()) {
        // add sorting
        final Function<Collation, Bson> toSortFn = col -> {
            final String path = col.path().toStringPath();
            return col.direction().isAscending() ? Sorts.ascending(path) : Sorts.descending(path);
        };
        final List<Bson> sorts = query.collations().stream().map(toSortFn).collect(Collectors.toList());
        find.sort(Sorts.orderBy(sorts));
    }
    query.limit().ifPresent(limit -> find.limit((int) limit));
    query.offset().ifPresent(offset -> find.skip((int) offset));
    if (hasProjections) {
        List<String> fields = query.projections().stream().map(p -> pathNaming.name((Path) p)).collect(Collectors.toList());
        find.projection(Projections.include(fields));
        return find;
    }
    // post-process result with projections
    return find;
}
Also used : Path(org.immutables.criteria.expression.Path) 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) ExpressionNaming(org.immutables.criteria.backend.ExpressionNaming) Query(org.immutables.criteria.expression.Query) Collation(org.immutables.criteria.expression.Collation) Bson(org.bson.conversions.Bson) BsonDocument(org.bson.BsonDocument) CodecRegistry(org.bson.codecs.configuration.CodecRegistry)

Example 9 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project mongo-java-driver by mongodb.

the class GridFSUploadPublisherImpl method createCheckAndCreateIndexesMono.

private Mono<Void> createCheckAndCreateIndexesMono() {
    MongoCollection<Document> collection = filesCollection.withDocumentClass(Document.class).withReadPreference(primary());
    FindPublisher<Document> findPublisher;
    if (clientSession != null) {
        findPublisher = collection.find(clientSession);
    } else {
        findPublisher = collection.find();
    }
    AtomicBoolean collectionExists = new AtomicBoolean(false);
    return Mono.create(sink -> Mono.from(findPublisher.projection(PROJECTION).first()).subscribe(d -> collectionExists.set(true), sink::error, () -> {
        if (collectionExists.get()) {
            sink.success();
        } else {
            checkAndCreateIndex(filesCollection.withReadPreference(primary()), FILES_INDEX).doOnError(sink::error).doOnSuccess(i -> {
                checkAndCreateIndex(chunksCollection.withReadPreference(primary()), CHUNKS_INDEX).doOnError(sink::error).doOnSuccess(sink::success).subscribe();
            }).subscribe();
        }
    }));
}
Also used : Document(org.bson.Document) ListIndexesPublisher(com.mongodb.reactivestreams.client.ListIndexesPublisher) Date(java.util.Date) MongoGridFSException(com.mongodb.MongoGridFSException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) Function(java.util.function.Function) ByteBuffer(java.nio.ByteBuffer) BsonValue(org.bson.BsonValue) GridFSUploadPublisher(com.mongodb.reactivestreams.client.gridfs.GridFSUploadPublisher) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Subscriber(org.reactivestreams.Subscriber) GridFSFile(com.mongodb.client.gridfs.model.GridFSFile) Binary(org.bson.types.Binary) InsertOneResult(com.mongodb.client.result.InsertOneResult) Publisher(org.reactivestreams.Publisher) Mono(reactor.core.publisher.Mono) ClientSession(com.mongodb.reactivestreams.client.ClientSession) Consumer(java.util.function.Consumer) Flux(reactor.core.publisher.Flux) AtomicLong(java.util.concurrent.atomic.AtomicLong) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) DeleteResult(com.mongodb.client.result.DeleteResult) ObjectId(org.bson.types.ObjectId) ReadPreference.primary(com.mongodb.ReadPreference.primary) Nullable(com.mongodb.lang.Nullable) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Document(org.bson.Document)

Example 10 with MongoCollection

use of com.mongodb.reactivestreams.client.MongoCollection in project mongo-java-driver by mongodb.

the class GridFSPublisherCreator method createDeletePublisher.

public static Publisher<Void> createDeletePublisher(final MongoCollection<GridFSFile> filesCollection, final MongoCollection<Document> chunksCollection, @Nullable final ClientSession clientSession, final BsonValue id) {
    notNull("filesCollection", filesCollection);
    notNull("chunksCollection", chunksCollection);
    notNull("id", id);
    BsonDocument filter = new BsonDocument("_id", id);
    Publisher<DeleteResult> fileDeletePublisher;
    if (clientSession == null) {
        fileDeletePublisher = filesCollection.deleteOne(filter);
    } else {
        fileDeletePublisher = filesCollection.deleteOne(clientSession, filter);
    }
    return Mono.from(fileDeletePublisher).flatMap(deleteResult -> {
        if (deleteResult.wasAcknowledged() && deleteResult.getDeletedCount() == 0) {
            throw new MongoGridFSException(format("No file found with the ObjectId: %s", id));
        }
        if (clientSession == null) {
            return Mono.from(chunksCollection.deleteMany(new BsonDocument("files_id", id)));
        } else {
            return Mono.from(chunksCollection.deleteMany(clientSession, new BsonDocument("files_id", id)));
        }
    }).flatMap(i -> Mono.empty());
}
Also used : Document(org.bson.Document) GridFSFile(com.mongodb.client.gridfs.model.GridFSFile) Publisher(org.reactivestreams.Publisher) MongoGridFSException(com.mongodb.MongoGridFSException) Mono(reactor.core.publisher.Mono) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) ClientSession(com.mongodb.reactivestreams.client.ClientSession) BsonString(org.bson.BsonString) ByteBuffer(java.nio.ByteBuffer) String.format(java.lang.String.format) BsonDocument(org.bson.BsonDocument) BsonValue(org.bson.BsonValue) Bson(org.bson.conversions.Bson) GridFSUploadOptions(com.mongodb.client.gridfs.model.GridFSUploadOptions) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) UpdateResult(com.mongodb.client.result.UpdateResult) GridFSDownloadOptions(com.mongodb.client.gridfs.model.GridFSDownloadOptions) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) DeleteResult(com.mongodb.client.result.DeleteResult) GridFSFindPublisher(com.mongodb.reactivestreams.client.gridfs.GridFSFindPublisher) Nullable(com.mongodb.lang.Nullable) BsonDocument(org.bson.BsonDocument) MongoGridFSException(com.mongodb.MongoGridFSException) DeleteResult(com.mongodb.client.result.DeleteResult)

Aggregations

MongoCollection (com.mongodb.reactivestreams.client.MongoCollection)13 Document (org.bson.Document)12 FindPublisher (com.mongodb.reactivestreams.client.FindPublisher)10 Collectors (java.util.stream.Collectors)10 BsonValue (org.bson.BsonValue)10 Publisher (org.reactivestreams.Publisher)10 List (java.util.List)8 Function (java.util.function.Function)8 Bson (org.bson.conversions.Bson)8 FullDocument (com.mongodb.client.model.changestream.FullDocument)7 ChangeStreamPublisher (com.mongodb.reactivestreams.client.ChangeStreamPublisher)7 MongoClient (com.mongodb.reactivestreams.client.MongoClient)7 Flux (reactor.core.publisher.Flux)7 MongoException (com.mongodb.MongoException)6 MongoDatabase (com.mongodb.reactivestreams.client.MongoDatabase)6 Optional (java.util.Optional)6 BsonDocument (org.bson.BsonDocument)6 Mono (reactor.core.publisher.Mono)6 DeleteResult (com.mongodb.client.result.DeleteResult)5 InsertOneResult (com.mongodb.client.result.InsertOneResult)4