Search in sources :

Example 11 with MongoCollection

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

the class BatchCursorFluxTest method ensureExists.

/**
 * This method ensures that the server considers the specified {@code collection} existing for the purposes of, e.g.,
 * {@link MongoCollection#drop()}, instead of replying with
 * {@code "errmsg": "ns not found", "code": 26, "codeName": "NamespaceNotFound"}.
 *
 * @return {@code operationTime} starting at which the {@code collection} is guaranteed to exist.
 */
private static BsonTimestamp ensureExists(final MongoClient client, final MongoCollection<Document> collection) {
    BsonValue insertedId = Mono.from(collection.insertOne(Document.parse("{}"))).map(InsertOneResult::getInsertedId).block(TIMEOUT_DURATION);
    BsonArray deleteStatements = new BsonArray();
    deleteStatements.add(new BsonDocument().append("q", new BsonDocument().append("_id", insertedId)).append("limit", new BsonInt32(1)));
    Publisher<Document> deletePublisher = client.getDatabase(collection.getNamespace().getDatabaseName()).runCommand(new BsonDocument().append("delete", new BsonString(collection.getNamespace().getCollectionName())).append("deletes", deleteStatements));
    BsonTimestamp operationTime = Mono.from(deletePublisher).map(doc -> doc.get("operationTime", BsonTimestamp.class)).block(TIMEOUT_DURATION);
    assertNotNull(operationTime);
    return operationTime;
}
Also used : Document(org.bson.Document) IntStream(java.util.stream.IntStream) BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Mock(org.mockito.Mock) MongoClients(com.mongodb.reactivestreams.client.MongoClients) ChangeStreamDocument(com.mongodb.client.model.changestream.ChangeStreamDocument) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) BsonString(org.bson.BsonString) MongoClient(com.mongodb.reactivestreams.client.MongoClient) BsonDocument(org.bson.BsonDocument) BsonValue(org.bson.BsonValue) TIMEOUT_DURATION(com.mongodb.ClusterFixture.TIMEOUT_DURATION) Fixture.getMongoClientBuilderFromConnectionString(com.mongodb.reactivestreams.client.Fixture.getMongoClientBuilderFromConnectionString) Collections.singletonList(java.util.Collections.singletonList) Fixture.drop(com.mongodb.reactivestreams.client.Fixture.drop) TestCommandListener(com.mongodb.internal.connection.TestCommandListener) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) BsonTimestamp(org.bson.BsonTimestamp) Arrays.asList(java.util.Arrays.asList) BsonArray(org.bson.BsonArray) Assumptions.assumeTrue(org.junit.jupiter.api.Assumptions.assumeTrue) Fixture.isReplicaSet(com.mongodb.reactivestreams.client.Fixture.isReplicaSet) Assertions.assertAll(org.junit.jupiter.api.Assertions.assertAll) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) CommandEvent(com.mongodb.event.CommandEvent) TestSubscriber(com.mongodb.reactivestreams.client.TestSubscriber) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) InsertOneResult(com.mongodb.client.result.InsertOneResult) Assertions.assertIterableEquals(org.junit.jupiter.api.Assertions.assertIterableEquals) Collections.emptyList(java.util.Collections.emptyList) Publisher(org.reactivestreams.Publisher) Mono(reactor.core.publisher.Mono) Fixture.serverVersionAtLeast(com.mongodb.reactivestreams.client.Fixture.serverVersionAtLeast) Mockito.when(org.mockito.Mockito.when) ClusterFixture.getDefaultDatabaseName(com.mongodb.ClusterFixture.getDefaultDatabaseName) Collectors(java.util.stream.Collectors) DisplayName(org.junit.jupiter.api.DisplayName) Test(org.junit.jupiter.api.Test) AfterEach(org.junit.jupiter.api.AfterEach) List(java.util.List) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) MongoClientSettings(com.mongodb.MongoClientSettings) BsonInt32(org.bson.BsonInt32) BsonInt32(org.bson.BsonInt32) BsonDocument(org.bson.BsonDocument) BsonString(org.bson.BsonString) BsonArray(org.bson.BsonArray) Document(org.bson.Document) ChangeStreamDocument(com.mongodb.client.model.changestream.ChangeStreamDocument) BsonDocument(org.bson.BsonDocument) BsonTimestamp(org.bson.BsonTimestamp) BsonValue(org.bson.BsonValue)

Example 12 with MongoCollection

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

the class ReactiveMongoTemplate method doRemove.

protected <T> Mono<DeleteResult> doRemove(String collectionName, Query query, @Nullable Class<T> entityClass) {
    if (query == null) {
        throw new InvalidDataAccessApiUsageException("Query passed in to remove can't be null!");
    }
    Assert.hasText(collectionName, "Collection name must not be null or empty!");
    MongoPersistentEntity<?> entity = getPersistentEntity(entityClass);
    DeleteContext deleteContext = queryOperations.deleteQueryContext(query);
    Document queryObject = deleteContext.getMappedQuery(entity);
    DeleteOptions deleteOptions = deleteContext.getDeleteOptions(entityClass);
    Document removeQuery = deleteContext.getMappedQuery(entity);
    MongoAction mongoAction = new MongoAction(writeConcern, MongoActionOperation.REMOVE, collectionName, entityClass, null, removeQuery);
    WriteConcern writeConcernToUse = prepareWriteConcern(mongoAction);
    return execute(collectionName, collection -> {
        maybeEmitEvent(new BeforeDeleteEvent<>(removeQuery, entityClass, collectionName));
        MongoCollection<Document> collectionToUse = prepareCollection(collection, writeConcernToUse);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(String.format("Remove using query: %s in collection: %s.", serializeToJsonSafely(removeQuery), collectionName));
        }
        if (query.getLimit() > 0 || query.getSkip() > 0) {
            FindPublisher<Document> cursor = new QueryFindPublisherPreparer(query, entityClass).prepare(// 
            collection.find(removeQuery)).projection(MappedDocument.getIdOnlyProjection());
            return // 
            Flux.from(cursor).map(// 
            MappedDocument::of).map(// 
            MappedDocument::getId).collectList().flatMapMany(val -> {
                return collectionToUse.deleteMany(MappedDocument.getIdIn(val), deleteOptions);
            });
        } else {
            return collectionToUse.deleteMany(removeQuery, deleteOptions);
        }
    }).doOnNext(// 
    it -> maybeEmitEvent(new AfterDeleteEvent<>(queryObject, entityClass, collectionName))).next();
}
Also used : Document(org.bson.Document) Arrays(java.util.Arrays) BasicQuery(org.springframework.data.mongodb.core.query.BasicQuery) NumberUtils(org.springframework.util.NumberUtils) BsonUtils(org.springframework.data.mongodb.util.BsonUtils) Tuples(reactor.util.function.Tuples) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) ReactiveMongoDatabaseUtils(org.springframework.data.mongodb.ReactiveMongoDatabaseUtils) FullDocument(com.mongodb.client.model.changestream.FullDocument) QueryContext(org.springframework.data.mongodb.core.QueryOperations.QueryContext) Optionals(org.springframework.data.util.Optionals) UpdateResult(com.mongodb.client.result.UpdateResult) Map(java.util.Map) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) CursorOption(org.springframework.data.mongodb.core.query.Meta.CursorOption) MongoJsonSchemaMapper(org.springframework.data.mongodb.core.convert.MongoJsonSchemaMapper) AggregationOperationContext(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext) ClassUtils(org.springframework.util.ClassUtils) NearQuery(org.springframework.data.mongodb.core.query.NearQuery) MappingContextEvent(org.springframework.data.mapping.context.MappingContextEvent) Aggregation(org.springframework.data.mongodb.core.aggregation.Aggregation) CollectionUtils(org.springframework.util.CollectionUtils) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) LogFactory(org.apache.commons.logging.LogFactory) DistinctQueryContext(org.springframework.data.mongodb.core.QueryOperations.DistinctQueryContext) ApplicationContextAware(org.springframework.context.ApplicationContextAware) Validator(org.springframework.data.mongodb.core.validation.Validator) MongoCustomConversions(org.springframework.data.mongodb.core.convert.MongoCustomConversions) MappingContext(org.springframework.data.mapping.context.MappingContext) ArrayList(java.util.ArrayList) UpdateDefinition(org.springframework.data.mongodb.core.query.UpdateDefinition) MongoClient(com.mongodb.reactivestreams.client.MongoClient) Bson(org.bson.conversions.Bson) NoOpDbRefResolver(org.springframework.data.mongodb.core.convert.NoOpDbRefResolver) ReactiveMongoPersistentEntityIndexCreator(org.springframework.data.mongodb.core.index.ReactiveMongoPersistentEntityIndexCreator) DbRefResolver(org.springframework.data.mongodb.core.convert.DbRefResolver) MappingException(org.springframework.data.mapping.MappingException) MongoDatabase(com.mongodb.reactivestreams.client.MongoDatabase) Nullable(org.springframework.lang.Nullable) JsonSchemaMapper(org.springframework.data.mongodb.core.convert.JsonSchemaMapper) MongoSimpleTypes(org.springframework.data.mongodb.core.mapping.MongoSimpleTypes) com.mongodb.client.model(com.mongodb.client.model) PrefixingDelegatingAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.PrefixingDelegatingAggregationOperationContext) CountContext(org.springframework.data.mongodb.core.QueryOperations.CountContext) ReactiveIndexOperations(org.springframework.data.mongodb.core.index.ReactiveIndexOperations) org.springframework.data.mongodb.core.mapping.event(org.springframework.data.mongodb.core.mapping.event) QueryMapper(org.springframework.data.mongodb.core.convert.QueryMapper) Publisher(org.reactivestreams.Publisher) ObjectUtils(org.springframework.util.ObjectUtils) DeleteContext(org.springframework.data.mongodb.core.QueryOperations.DeleteContext) 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) RelaxedTypeBasedAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.RelaxedTypeBasedAggregationOperationContext) ResourceUtils(org.springframework.util.ResourceUtils) Flux(reactor.core.publisher.Flux) ObjectId(org.bson.types.ObjectId) Collation(org.springframework.data.mongodb.core.query.Collation) EntityProjection(org.springframework.data.projection.EntityProjection) BsonValue(org.bson.BsonValue) PersistenceExceptionTranslator(org.springframework.dao.support.PersistenceExceptionTranslator) OptimisticLockingFailureException(org.springframework.dao.OptimisticLockingFailureException) MapReduceOptions(org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) AdaptibleEntity(org.springframework.data.mongodb.core.EntityOperations.AdaptibleEntity) CursorType(com.mongodb.CursorType) MongoWriter(org.springframework.data.mongodb.core.convert.MongoWriter) Meta(org.springframework.data.mongodb.core.query.Meta) ReactiveEntityCallbacks(org.springframework.data.mapping.callback.ReactiveEntityCallbacks) InsertOneResult(com.mongodb.client.result.InsertOneResult) SerializationUtils(org.springframework.data.mongodb.core.query.SerializationUtils) MongoException(com.mongodb.MongoException) Collection(java.util.Collection) ApplicationListener(org.springframework.context.ApplicationListener) Collectors(java.util.stream.Collectors) PersistentEntity(org.springframework.data.mapping.PersistentEntity) List(java.util.List) Optional(java.util.Optional) UpdateMapper(org.springframework.data.mongodb.core.convert.UpdateMapper) ReactiveMongoDatabaseFactory(org.springframework.data.mongodb.ReactiveMongoDatabaseFactory) TypeBasedAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.TypeBasedAggregationOperationContext) UpdateContext(org.springframework.data.mongodb.core.QueryOperations.UpdateContext) Metric(org.springframework.data.geo.Metric) ReadPreference(com.mongodb.ReadPreference) 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) HashMap(java.util.HashMap) InvalidDataAccessApiUsageException(org.springframework.dao.InvalidDataAccessApiUsageException) DistinctPublisher(com.mongodb.reactivestreams.client.DistinctPublisher) MongoDatabaseFactory(org.springframework.data.mongodb.MongoDatabaseFactory) MongoConverter(org.springframework.data.mongodb.core.convert.MongoConverter) Function(java.util.function.Function) Distance(org.springframework.data.geo.Distance) EntityReader(org.springframework.data.convert.EntityReader) ChangeStreamPublisher(com.mongodb.reactivestreams.client.ChangeStreamPublisher) ArrayFilter(org.springframework.data.mongodb.core.query.UpdateDefinition.ArrayFilter) Granularity(org.springframework.data.mongodb.core.timeseries.Granularity) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) AggregationDefinition(org.springframework.data.mongodb.core.QueryOperations.AggregationDefinition) Subscriber(org.reactivestreams.Subscriber) ApplicationEventPublisherAware(org.springframework.context.ApplicationEventPublisherAware) Iterator(java.util.Iterator) AggregationOptions(org.springframework.data.mongodb.core.aggregation.AggregationOptions) MapReducePublisher(com.mongodb.reactivestreams.client.MapReducePublisher) ClientSession(com.mongodb.reactivestreams.client.ClientSession) ApplicationContext(org.springframework.context.ApplicationContext) Query(org.springframework.data.mongodb.core.query.Query) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) MappingMongoConverter(org.springframework.data.mongodb.core.convert.MappingMongoConverter) AggregatePublisher(com.mongodb.reactivestreams.client.AggregatePublisher) ClientSessionOptions(com.mongodb.ClientSessionOptions) DeleteResult(com.mongodb.client.result.DeleteResult) Log(org.apache.commons.logging.Log) GeoResult(org.springframework.data.geo.GeoResult) SessionSynchronization(org.springframework.data.mongodb.SessionSynchronization) WriteConcern(com.mongodb.WriteConcern) Collections(java.util.Collections) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) DeleteContext(org.springframework.data.mongodb.core.QueryOperations.DeleteContext) Document(org.bson.Document) FullDocument(com.mongodb.client.model.changestream.FullDocument) WriteConcern(com.mongodb.WriteConcern) InvalidDataAccessApiUsageException(org.springframework.dao.InvalidDataAccessApiUsageException)

Example 13 with MongoCollection

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

the class ReactiveMongoTemplate method saveDocument.

protected Mono<Object> saveDocument(String collectionName, Document document, Class<?> entityClass) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(String.format("Saving Document containing fields: %s", document.keySet()));
    }
    return createMono(collectionName, collection -> {
        MongoAction mongoAction = new MongoAction(writeConcern, MongoActionOperation.SAVE, collectionName, entityClass, document, null);
        WriteConcern writeConcernToUse = prepareWriteConcern(mongoAction);
        MappedDocument mapped = MappedDocument.of(document);
        MongoCollection<Document> collectionToUse = // 
        writeConcernToUse == null ? // 
        collection : collection.withWriteConcern(writeConcernToUse);
        Publisher<?> publisher;
        if (!mapped.hasId()) {
            publisher = collectionToUse.insertOne(document);
        } else {
            MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(entityClass);
            UpdateContext updateContext = queryOperations.replaceSingleContext(mapped, true);
            Document filter = updateContext.getMappedQuery(entity);
            Document replacement = updateContext.getMappedUpdate(entity);
            Mono<Document> deferredFilter;
            if (updateContext.requiresShardKey(filter, entity)) {
                if (entity.getShardKey().isImmutable()) {
                    deferredFilter = Mono.just(updateContext.applyShardKey(entity, filter, null));
                } else {
                    deferredFilter = Mono.from(collection.find(filter, Document.class).projection(updateContext.getMappedShardKey(entity)).first()).defaultIfEmpty(replacement).map(it -> updateContext.applyShardKey(entity, filter, it));
                }
            } else {
                deferredFilter = Mono.just(filter);
            }
            publisher = deferredFilter.flatMapMany(it -> collectionToUse.replaceOne(it, replacement, updateContext.getReplaceOptions(entityClass)));
        }
        return Mono.from(publisher).map(o -> mapped.getId());
    });
}
Also used : Document(org.bson.Document) Arrays(java.util.Arrays) BasicQuery(org.springframework.data.mongodb.core.query.BasicQuery) NumberUtils(org.springframework.util.NumberUtils) BsonUtils(org.springframework.data.mongodb.util.BsonUtils) Tuples(reactor.util.function.Tuples) MongoCollection(com.mongodb.reactivestreams.client.MongoCollection) ReactiveMongoDatabaseUtils(org.springframework.data.mongodb.ReactiveMongoDatabaseUtils) FullDocument(com.mongodb.client.model.changestream.FullDocument) QueryContext(org.springframework.data.mongodb.core.QueryOperations.QueryContext) Optionals(org.springframework.data.util.Optionals) UpdateResult(com.mongodb.client.result.UpdateResult) Map(java.util.Map) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) CursorOption(org.springframework.data.mongodb.core.query.Meta.CursorOption) MongoJsonSchemaMapper(org.springframework.data.mongodb.core.convert.MongoJsonSchemaMapper) AggregationOperationContext(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext) ClassUtils(org.springframework.util.ClassUtils) NearQuery(org.springframework.data.mongodb.core.query.NearQuery) MappingContextEvent(org.springframework.data.mapping.context.MappingContextEvent) Aggregation(org.springframework.data.mongodb.core.aggregation.Aggregation) CollectionUtils(org.springframework.util.CollectionUtils) FindPublisher(com.mongodb.reactivestreams.client.FindPublisher) LogFactory(org.apache.commons.logging.LogFactory) DistinctQueryContext(org.springframework.data.mongodb.core.QueryOperations.DistinctQueryContext) ApplicationContextAware(org.springframework.context.ApplicationContextAware) Validator(org.springframework.data.mongodb.core.validation.Validator) MongoCustomConversions(org.springframework.data.mongodb.core.convert.MongoCustomConversions) MappingContext(org.springframework.data.mapping.context.MappingContext) ArrayList(java.util.ArrayList) UpdateDefinition(org.springframework.data.mongodb.core.query.UpdateDefinition) MongoClient(com.mongodb.reactivestreams.client.MongoClient) Bson(org.bson.conversions.Bson) NoOpDbRefResolver(org.springframework.data.mongodb.core.convert.NoOpDbRefResolver) ReactiveMongoPersistentEntityIndexCreator(org.springframework.data.mongodb.core.index.ReactiveMongoPersistentEntityIndexCreator) DbRefResolver(org.springframework.data.mongodb.core.convert.DbRefResolver) MappingException(org.springframework.data.mapping.MappingException) MongoDatabase(com.mongodb.reactivestreams.client.MongoDatabase) Nullable(org.springframework.lang.Nullable) JsonSchemaMapper(org.springframework.data.mongodb.core.convert.JsonSchemaMapper) MongoSimpleTypes(org.springframework.data.mongodb.core.mapping.MongoSimpleTypes) com.mongodb.client.model(com.mongodb.client.model) PrefixingDelegatingAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.PrefixingDelegatingAggregationOperationContext) CountContext(org.springframework.data.mongodb.core.QueryOperations.CountContext) ReactiveIndexOperations(org.springframework.data.mongodb.core.index.ReactiveIndexOperations) org.springframework.data.mongodb.core.mapping.event(org.springframework.data.mongodb.core.mapping.event) QueryMapper(org.springframework.data.mongodb.core.convert.QueryMapper) Publisher(org.reactivestreams.Publisher) ObjectUtils(org.springframework.util.ObjectUtils) DeleteContext(org.springframework.data.mongodb.core.QueryOperations.DeleteContext) 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) RelaxedTypeBasedAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.RelaxedTypeBasedAggregationOperationContext) ResourceUtils(org.springframework.util.ResourceUtils) Flux(reactor.core.publisher.Flux) ObjectId(org.bson.types.ObjectId) Collation(org.springframework.data.mongodb.core.query.Collation) EntityProjection(org.springframework.data.projection.EntityProjection) BsonValue(org.bson.BsonValue) PersistenceExceptionTranslator(org.springframework.dao.support.PersistenceExceptionTranslator) OptimisticLockingFailureException(org.springframework.dao.OptimisticLockingFailureException) MapReduceOptions(org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) AdaptibleEntity(org.springframework.data.mongodb.core.EntityOperations.AdaptibleEntity) CursorType(com.mongodb.CursorType) MongoWriter(org.springframework.data.mongodb.core.convert.MongoWriter) Meta(org.springframework.data.mongodb.core.query.Meta) ReactiveEntityCallbacks(org.springframework.data.mapping.callback.ReactiveEntityCallbacks) InsertOneResult(com.mongodb.client.result.InsertOneResult) SerializationUtils(org.springframework.data.mongodb.core.query.SerializationUtils) MongoException(com.mongodb.MongoException) Collection(java.util.Collection) ApplicationListener(org.springframework.context.ApplicationListener) Collectors(java.util.stream.Collectors) PersistentEntity(org.springframework.data.mapping.PersistentEntity) List(java.util.List) Optional(java.util.Optional) UpdateMapper(org.springframework.data.mongodb.core.convert.UpdateMapper) ReactiveMongoDatabaseFactory(org.springframework.data.mongodb.ReactiveMongoDatabaseFactory) TypeBasedAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.TypeBasedAggregationOperationContext) UpdateContext(org.springframework.data.mongodb.core.QueryOperations.UpdateContext) Metric(org.springframework.data.geo.Metric) ReadPreference(com.mongodb.ReadPreference) 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) HashMap(java.util.HashMap) InvalidDataAccessApiUsageException(org.springframework.dao.InvalidDataAccessApiUsageException) DistinctPublisher(com.mongodb.reactivestreams.client.DistinctPublisher) MongoDatabaseFactory(org.springframework.data.mongodb.MongoDatabaseFactory) MongoConverter(org.springframework.data.mongodb.core.convert.MongoConverter) Function(java.util.function.Function) Distance(org.springframework.data.geo.Distance) EntityReader(org.springframework.data.convert.EntityReader) ChangeStreamPublisher(com.mongodb.reactivestreams.client.ChangeStreamPublisher) ArrayFilter(org.springframework.data.mongodb.core.query.UpdateDefinition.ArrayFilter) Granularity(org.springframework.data.mongodb.core.timeseries.Granularity) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) AggregationDefinition(org.springframework.data.mongodb.core.QueryOperations.AggregationDefinition) Subscriber(org.reactivestreams.Subscriber) ApplicationEventPublisherAware(org.springframework.context.ApplicationEventPublisherAware) Iterator(java.util.Iterator) AggregationOptions(org.springframework.data.mongodb.core.aggregation.AggregationOptions) MapReducePublisher(com.mongodb.reactivestreams.client.MapReducePublisher) ClientSession(com.mongodb.reactivestreams.client.ClientSession) ApplicationContext(org.springframework.context.ApplicationContext) Query(org.springframework.data.mongodb.core.query.Query) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) MappingMongoConverter(org.springframework.data.mongodb.core.convert.MappingMongoConverter) AggregatePublisher(com.mongodb.reactivestreams.client.AggregatePublisher) ClientSessionOptions(com.mongodb.ClientSessionOptions) DeleteResult(com.mongodb.client.result.DeleteResult) Log(org.apache.commons.logging.Log) GeoResult(org.springframework.data.geo.GeoResult) SessionSynchronization(org.springframework.data.mongodb.SessionSynchronization) WriteConcern(com.mongodb.WriteConcern) Collections(java.util.Collections) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) WriteConcern(com.mongodb.WriteConcern) UpdateContext(org.springframework.data.mongodb.core.QueryOperations.UpdateContext) Document(org.bson.Document) FullDocument(com.mongodb.client.model.changestream.FullDocument)

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