Search in sources :

Example 1 with Collation

use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.

the class MongoTemplate method doRemove.

protected <T> DeleteResult doRemove(final String collectionName, final Query query, @Nullable final Class<T> entityClass) {
    Assert.notNull(query, "Query must not be null!");
    Assert.hasText(collectionName, "Collection name must not be null or empty!");
    final MongoPersistentEntity<?> entity = getPersistentEntity(entityClass);
    final Document queryObject = queryMapper.getMappedObject(query.getQueryObject(), entity);
    return execute(collectionName, new CollectionCallback<DeleteResult>() {

        public DeleteResult doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException {
            maybeEmitEvent(new BeforeDeleteEvent<T>(queryObject, entityClass, collectionName));
            Document removeQuery = queryObject;
            DeleteOptions options = new DeleteOptions();
            query.getCollation().map(Collation::toMongoCollation).ifPresent(options::collation);
            MongoAction mongoAction = new MongoAction(writeConcern, MongoActionOperation.REMOVE, collectionName, entityClass, null, queryObject);
            WriteConcern writeConcernToUse = prepareWriteConcern(mongoAction);
            DeleteResult dr = null;
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Remove using query: {} in collection: {}.", new Object[] { serializeToJsonSafely(removeQuery), collectionName });
            }
            if (query.getLimit() > 0 || query.getSkip() > 0) {
                MongoCursor<Document> cursor = new QueryCursorPreparer(query, entityClass).prepare(collection.find(removeQuery).projection(new Document(ID_FIELD, 1))).iterator();
                Set<Object> ids = new LinkedHashSet<>();
                while (cursor.hasNext()) {
                    ids.add(cursor.next().get(ID_FIELD));
                }
                removeQuery = new Document(ID_FIELD, new Document("$in", ids));
            }
            if (writeConcernToUse == null) {
                dr = collection.deleteMany(removeQuery, options);
            } else {
                dr = collection.withWriteConcern(writeConcernToUse).deleteMany(removeQuery, options);
            }
            maybeEmitEvent(new AfterDeleteEvent<T>(queryObject, entityClass, collectionName));
            return dr;
        }
    });
}
Also used : MongoException(com.mongodb.MongoException) Document(org.bson.Document) BeforeDeleteEvent(org.springframework.data.mongodb.core.mapping.event.BeforeDeleteEvent) Collation(org.springframework.data.mongodb.core.query.Collation) AfterDeleteEvent(org.springframework.data.mongodb.core.mapping.event.AfterDeleteEvent) WriteConcern(com.mongodb.WriteConcern) MongoCursor(com.mongodb.client.MongoCursor) DeleteResult(com.mongodb.client.result.DeleteResult) DataAccessException(org.springframework.dao.DataAccessException)

Example 2 with Collation

use of org.springframework.data.mongodb.core.query.Collation in project cas by apereo.

the class MongoDbWebAuthnCredentialRepository method update.

@Override
@SneakyThrows
protected void update(final String username, final Collection<CredentialRegistration> givenRecords) {
    val records = givenRecords.stream().map(record -> {
        if (record.getRegistrationTime() == null) {
            return record.withRegistrationTime(Instant.now(Clock.systemUTC()));
        }
        return record;
    }).collect(Collectors.toList());
    val query = new Query(Criteria.where(MongoDbWebAuthnCredentialRegistration.FIELD_USERNAME).is(username)).collation(Collation.of(Locale.ENGLISH).strength(Collation.ComparisonLevel.primary()));
    val collection = getProperties().getAuthn().getMfa().getWebAuthn().getMongo().getCollection();
    if (records.isEmpty()) {
        LOGGER.debug("No records are provided for [{}] so entry will be removed", username);
        mongoTemplate.remove(query, MongoDbWebAuthnCredentialRegistration.class, collection);
    } else {
        val jsonRecords = getCipherExecutor().encode(WebAuthnUtils.getObjectMapper().writeValueAsString(records));
        val entry = MongoDbWebAuthnCredentialRegistration.builder().records(jsonRecords).username(username).build();
        val update = Update.update(MongoDbWebAuthnCredentialRegistration.FIELD_RECORDS, jsonRecords);
        val result = mongoTemplate.updateFirst(query, update, collection);
        if (result.getMatchedCount() <= 0) {
            LOGGER.debug("Storing new registration record for [{}]", username);
            mongoTemplate.save(entry, collection);
        }
    }
}
Also used : lombok.val(lombok.val) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) Unchecked(org.jooq.lambda.Unchecked) SneakyThrows(lombok.SneakyThrows) CipherExecutor(org.apereo.cas.util.crypto.CipherExecutor) Collection(java.util.Collection) lombok.val(lombok.val) CredentialRegistration(com.yubico.data.CredentialRegistration) Set(java.util.Set) BaseWebAuthnCredentialRepository(org.apereo.cas.webauthn.storage.BaseWebAuthnCredentialRepository) Collation(org.springframework.data.mongodb.core.query.Collation) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Criteria(org.springframework.data.mongodb.core.query.Criteria) Query(org.springframework.data.mongodb.core.query.Query) Slf4j(lombok.extern.slf4j.Slf4j) Stream(java.util.stream.Stream) Locale(java.util.Locale) MongoOperations(org.springframework.data.mongodb.core.MongoOperations) Update(org.springframework.data.mongodb.core.query.Update) Clock(java.time.Clock) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Query(org.springframework.data.mongodb.core.query.Query) SneakyThrows(lombok.SneakyThrows)

Example 3 with Collation

use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.

the class MongoTemplate method doAggregate.

@SuppressWarnings("ConstantConditions")
protected <O> AggregationResults<O> doAggregate(Aggregation aggregation, String collectionName, Class<O> outputType, AggregationOperationContext context) {
    ReadDocumentCallback<O> callback = new ReadDocumentCallback<>(mongoConverter, outputType, collectionName);
    AggregationOptions options = aggregation.getOptions();
    AggregationUtil aggregationUtil = new AggregationUtil(queryMapper, mappingContext);
    if (options.isExplain()) {
        Document command = aggregationUtil.createCommand(collectionName, aggregation, context);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(String.format("Executing aggregation: %s", serializeToJsonSafely(command)));
        }
        Document commandResult = executeCommand(command);
        return new AggregationResults<>(commandResult.get("results", new ArrayList<Document>(0)).stream().map(callback::doWith).collect(Collectors.toList()), commandResult);
    }
    List<Document> pipeline = aggregationUtil.createPipeline(aggregation, context);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(String.format("Executing aggregation: %s in collection %s", serializeToJsonSafely(pipeline), collectionName));
    }
    return execute(collectionName, collection -> {
        List<Document> rawResult = new ArrayList<>();
        Class<?> domainType = aggregation instanceof TypedAggregation ? ((TypedAggregation<?>) aggregation).getInputType() : null;
        Optional<Collation> collation = Optionals.firstNonEmpty(options::getCollation, () -> // 
        operations.forType(domainType).getCollation());
        AggregateIterable<Document> aggregateIterable = // 
        collection.aggregate(pipeline, Document.class).collation(// 
        collation.map(Collation::toMongoCollation).orElse(null)).allowDiskUse(options.isAllowDiskUse());
        if (options.getCursorBatchSize() != null) {
            aggregateIterable = aggregateIterable.batchSize(options.getCursorBatchSize());
        }
        options.getComment().ifPresent(aggregateIterable::comment);
        options.getHint().ifPresent(aggregateIterable::hint);
        if (options.hasExecutionTimeLimit()) {
            aggregateIterable = aggregateIterable.maxTime(options.getMaxTime().toMillis(), TimeUnit.MILLISECONDS);
        }
        if (options.isSkipResults()) {
            // toCollection only allowed for $out and $merge if those are the last stages
            if (aggregation.getPipeline().isOutOrMerge()) {
                aggregateIterable.toCollection();
            } else {
                aggregateIterable.first();
            }
            return new AggregationResults<>(Collections.emptyList(), new Document());
        }
        MongoIterable<O> iterable = aggregateIterable.map(val -> {
            rawResult.add(val);
            return callback.doWith(val);
        });
        return new AggregationResults<>(iterable.into(new ArrayList<>()), new Document("results", rawResult).append("ok", 1.0D));
    });
}
Also used : AggregationOptions(org.springframework.data.mongodb.core.aggregation.AggregationOptions) Document(org.bson.Document) Collation(org.springframework.data.mongodb.core.query.Collation) AggregationResults(org.springframework.data.mongodb.core.aggregation.AggregationResults) TypedAggregation(org.springframework.data.mongodb.core.aggregation.TypedAggregation)

Example 4 with Collation

use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.

the class MongoTemplate method mapReduce.

/**
 * @param query
 * @param domainType
 * @param inputCollectionName
 * @param mapFunction
 * @param reduceFunction
 * @param mapReduceOptions
 * @param resultType
 * @return
 * @since 2.1
 * @deprecated since 3.4 in favor of {@link #aggregate(TypedAggregation, Class)}.
 */
@Deprecated
public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputCollectionName, String mapFunction, String reduceFunction, @Nullable MapReduceOptions mapReduceOptions, Class<T> resultType) {
    Assert.notNull(domainType, "Domain type must not be null!");
    Assert.notNull(inputCollectionName, "Input collection name must not be null!");
    Assert.notNull(resultType, "Result type must not be null!");
    Assert.notNull(mapFunction, "Map function must not be null!");
    Assert.notNull(reduceFunction, "Reduce function must not be null!");
    String mapFunc = replaceWithResourceIfNecessary(mapFunction);
    String reduceFunc = replaceWithResourceIfNecessary(reduceFunction);
    MongoCollection<Document> inputCollection = getAndPrepareCollection(doGetDatabase(), inputCollectionName);
    // MapReduceOp
    MapReduceIterable<Document> mapReduce = inputCollection.mapReduce(mapFunc, reduceFunc, Document.class);
    if (query.getLimit() > 0 && mapReduceOptions != null && mapReduceOptions.getLimit() == null) {
        mapReduce = mapReduce.limit(query.getLimit());
    }
    if (query.getMeta().getMaxTimeMsec() != null) {
        mapReduce = mapReduce.maxTime(query.getMeta().getMaxTimeMsec(), TimeUnit.MILLISECONDS);
    }
    Document mappedSort = getMappedSortObject(query, domainType);
    if (mappedSort != null && !mappedSort.isEmpty()) {
        mapReduce = mapReduce.sort(mappedSort);
    }
    mapReduce = mapReduce.filter(queryMapper.getMappedObject(query.getQueryObject(), mappingContext.getPersistentEntity(domainType)));
    Optional<Collation> collation = query.getCollation();
    if (mapReduceOptions != null) {
        Optionals.ifAllPresent(collation, mapReduceOptions.getCollation(), (l, r) -> {
            throw new IllegalArgumentException("Both Query and MapReduceOptions define a collation. Please provide the collation only via one of the two.");
        });
        if (mapReduceOptions.getCollation().isPresent()) {
            collation = mapReduceOptions.getCollation();
        }
        if (!CollectionUtils.isEmpty(mapReduceOptions.getScopeVariables())) {
            mapReduce = mapReduce.scope(new Document(mapReduceOptions.getScopeVariables()));
        }
        if (mapReduceOptions.getLimit() != null && mapReduceOptions.getLimit() > 0) {
            mapReduce = mapReduce.limit(mapReduceOptions.getLimit());
        }
        if (mapReduceOptions.getFinalizeFunction().filter(StringUtils::hasText).isPresent()) {
            mapReduce = mapReduce.finalizeFunction(mapReduceOptions.getFinalizeFunction().get());
        }
        if (mapReduceOptions.getJavaScriptMode() != null) {
            mapReduce = mapReduce.jsMode(mapReduceOptions.getJavaScriptMode());
        }
        if (mapReduceOptions.getOutputSharded().isPresent()) {
            mapReduce = mapReduce.sharded(mapReduceOptions.getOutputSharded().get());
        }
        if (StringUtils.hasText(mapReduceOptions.getOutputCollection()) && !mapReduceOptions.usesInlineOutput()) {
            mapReduce = mapReduce.collectionName(mapReduceOptions.getOutputCollection()).action(mapReduceOptions.getMapReduceAction());
            if (mapReduceOptions.getOutputDatabase().isPresent()) {
                mapReduce = mapReduce.databaseName(mapReduceOptions.getOutputDatabase().get());
            }
        }
    }
    if (!collation.isPresent()) {
        collation = operations.forType(domainType).getCollation();
    }
    mapReduce = collation.map(Collation::toMongoCollation).map(mapReduce::collation).orElse(mapReduce);
    List<T> mappedResults = new ArrayList<>();
    DocumentCallback<T> callback = new ReadDocumentCallback<>(mongoConverter, resultType, inputCollectionName);
    for (Document document : mapReduce) {
        mappedResults.add(callback.doWith(document));
    }
    return mappedResults;
}
Also used : Document(org.bson.Document) Collation(org.springframework.data.mongodb.core.query.Collation)

Example 5 with Collation

use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.

the class ReactiveMongoTemplate method changeStream.

@Override
public <T> Flux<ChangeStreamEvent<T>> changeStream(@Nullable String database, @Nullable String collectionName, ChangeStreamOptions options, Class<T> targetType) {
    List<Document> filter = prepareFilter(options);
    FullDocument fullDocument = ClassUtils.isAssignable(Document.class, targetType) ? FullDocument.DEFAULT : FullDocument.UPDATE_LOOKUP;
    return // 
    ReactiveMongoDatabaseUtils.getDatabase(database, mongoDatabaseFactory).map(db -> {
        ChangeStreamPublisher<Document> publisher;
        if (StringUtils.hasText(collectionName)) {
            publisher = filter.isEmpty() ? db.getCollection(collectionName).watch(Document.class) : db.getCollection(collectionName).watch(filter, Document.class);
        } else {
            publisher = filter.isEmpty() ? db.watch(Document.class) : db.watch(filter, Document.class);
        }
        publisher = options.getResumeToken().map(BsonValue::asDocument).map(publisher::resumeAfter).orElse(publisher);
        publisher = options.getCollation().map(Collation::toMongoCollation).map(publisher::collation).orElse(publisher);
        publisher = options.getResumeBsonTimestamp().map(publisher::startAtOperationTime).orElse(publisher);
        return publisher.fullDocument(options.getFullDocumentLookup().orElse(fullDocument));
    }).flatMapMany(publisher -> Flux.from(publisher).map(document -> new ChangeStreamEvent<>(document, targetType, getConverter())));
}
Also used : FullDocument(com.mongodb.client.model.changestream.FullDocument) 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) Document(org.bson.Document) FullDocument(com.mongodb.client.model.changestream.FullDocument) Collation(org.springframework.data.mongodb.core.query.Collation) ChangeStreamPublisher(com.mongodb.reactivestreams.client.ChangeStreamPublisher) BsonValue(org.bson.BsonValue)

Aggregations

Collation (org.springframework.data.mongodb.core.query.Collation)33 Query (org.springframework.data.mongodb.core.query.Query)24 Test (org.junit.jupiter.api.Test)19 Document (org.bson.Document)15 Collectors (java.util.stream.Collectors)7 DataAccessException (org.springframework.dao.DataAccessException)7 BasicQuery (org.springframework.data.mongodb.core.query.BasicQuery)7 MongoException (com.mongodb.MongoException)6 WriteConcern (com.mongodb.WriteConcern)6 DeleteResult (com.mongodb.client.result.DeleteResult)6 UpdateResult (com.mongodb.client.result.UpdateResult)6 AggregationOptions (org.springframework.data.mongodb.core.aggregation.AggregationOptions)6 TypedAggregation (org.springframework.data.mongodb.core.aggregation.TypedAggregation)6 Criteria (org.springframework.data.mongodb.core.query.Criteria)5 MongoPersistentEntity (org.springframework.data.mongodb.core.mapping.MongoPersistentEntity)4 FullDocument (com.mongodb.client.model.changestream.FullDocument)3 java.util (java.util)3 Collection (java.util.Collection)3 Bson (org.bson.conversions.Bson)3 BeansException (org.springframework.beans.BeansException)3