Search in sources :

Example 1 with MongoPersistentEntity

use of org.springframework.data.mongodb.core.mapping.MongoPersistentEntity in project spring-data-mongodb by spring-projects.

the class MongoOperationsUnitTests method operationsSetUp.

@Before
public final void operationsSetUp() {
    person = new Person("Oliver");
    persons = Arrays.asList(person);
    converter = new AbstractMongoConverter(null) {

        public void write(Object t, Bson bson) {
            ((Document) bson).put("firstName", person.getFirstName());
        }

        @SuppressWarnings("unchecked")
        public <S extends Object> S read(Class<S> clazz, Bson bson) {
            return (S) person;
        }

        public MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> getMappingContext() {
            return null;
        }

        public Object convertToMongoType(Object obj, TypeInformation<?> typeInformation) {
            return null;
        }

        public DBRef toDBRef(Object object, MongoPersistentProperty referingProperty) {
            return null;
        }

        @Override
        public MongoTypeMapper getTypeMapper() {
            return null;
        }
    };
}
Also used : MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) DBRef(com.mongodb.DBRef) AbstractMongoConverter(org.springframework.data.mongodb.core.convert.AbstractMongoConverter) Bson(org.bson.conversions.Bson) MappingContext(org.springframework.data.mapping.context.MappingContext) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) MongoTypeMapper(org.springframework.data.mongodb.core.convert.MongoTypeMapper) Before(org.junit.Before)

Example 2 with MongoPersistentEntity

use of org.springframework.data.mongodb.core.mapping.MongoPersistentEntity in project spring-data-mongodb by spring-projects.

the class ReactiveMongoTemplate method findDistinct.

/*
	 * (non-Javadoc)
	 * @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findDistinct(org.springframework.data.mongodb.core.query.Query, java.lang.String, java.lang.String, java.lang.Class, java.lang.Class)
	 */
@SuppressWarnings("unchecked")
public <T> Flux<T> findDistinct(Query query, String field, String collectionName, Class<?> entityClass, Class<T> resultClass) {
    Assert.notNull(query, "Query must not be null!");
    Assert.notNull(field, "Field must not be null!");
    Assert.notNull(collectionName, "CollectionName must not be null!");
    Assert.notNull(entityClass, "EntityClass must not be null!");
    Assert.notNull(resultClass, "ResultClass must not be null!");
    MongoPersistentEntity<?> entity = getPersistentEntity(entityClass);
    Document mappedQuery = queryMapper.getMappedObject(query.getQueryObject(), entity);
    String mappedFieldName = queryMapper.getMappedFields(new Document(field, 1), entity).keySet().iterator().next();
    Class<T> mongoDriverCompatibleType = mongoDatabaseFactory.getCodecFor(resultClass).map(Codec::getEncoderClass).orElse((Class) BsonValue.class);
    Flux<?> result = execute(collectionName, collection -> {
        DistinctPublisher<T> publisher = collection.distinct(mappedFieldName, mappedQuery, mongoDriverCompatibleType);
        return query.getCollation().map(Collation::toMongoCollation).map(publisher::collation).orElse(publisher);
    });
    if (resultClass == Object.class || mongoDriverCompatibleType != resultClass) {
        Class<?> targetType = getMostSpecificConversionTargetType(resultClass, entityClass, field);
        MongoConverter converter = getConverter();
        result = result.map(it -> converter.mapValueToTargetType(it, targetType, NO_OP_REF_RESOLVER));
    }
    return (Flux<T>) result;
}
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) Flux(reactor.core.publisher.Flux) 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) BsonValue(org.bson.BsonValue)

Example 3 with MongoPersistentEntity

use of org.springframework.data.mongodb.core.mapping.MongoPersistentEntity in project spring-data-mongodb by spring-projects.

the class MongoExampleMapper method getMappedPropertyPath.

private String getMappedPropertyPath(String path, Class<?> probeType) {
    MongoPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(probeType);
    Iterator<String> parts = Arrays.asList(path.split("\\.")).iterator();
    final Stack<MongoPersistentProperty> stack = new Stack<>();
    List<String> resultParts = new ArrayList<>();
    while (parts.hasNext()) {
        String part = parts.next();
        MongoPersistentProperty prop = entity.getPersistentProperty(part);
        if (prop == null) {
            entity.doWithProperties((PropertyHandler<MongoPersistentProperty>) property -> {
                if (property.getFieldName().equals(part)) {
                    stack.push(property);
                }
            });
            if (stack.isEmpty()) {
                return "";
            }
            prop = stack.pop();
        }
        resultParts.add(prop.getName());
        if (prop.isEntity() && mappingContext.hasPersistentEntityFor(prop.getActualType())) {
            entity = mappingContext.getRequiredPersistentEntity(prop.getActualType());
        } else {
            break;
        }
    }
    return StringUtils.collectionToDelimitedString(resultParts, ".");
}
Also used : Document(org.bson.Document) MongoRegexCreator(org.springframework.data.mongodb.core.query.MongoRegexCreator) Arrays(java.util.Arrays) MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) StringMatcher(org.springframework.data.domain.ExampleMatcher.StringMatcher) MappingContext(org.springframework.data.mapping.context.MappingContext) TypeInformation(org.springframework.data.util.TypeInformation) Stack(java.util.Stack) UntypedExampleMatcher(org.springframework.data.mongodb.core.query.UntypedExampleMatcher) ArrayList(java.util.ArrayList) PropertyHandler(org.springframework.data.mapping.PropertyHandler) ExampleMatcherAccessor(org.springframework.data.support.ExampleMatcherAccessor) HashSet(java.util.HashSet) NullHandler(org.springframework.data.domain.ExampleMatcher.NullHandler) Map(java.util.Map) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) MatchMode(org.springframework.data.mongodb.core.query.MongoRegexCreator.MatchMode) ClassUtils(org.springframework.util.ClassUtils) Iterator(java.util.Iterator) SerializationUtils(org.springframework.data.mongodb.core.query.SerializationUtils) ObjectUtils(org.springframework.util.ObjectUtils) Set(java.util.Set) Example(org.springframework.data.domain.Example) List(java.util.List) PropertyValueTransformer(org.springframework.data.domain.ExampleMatcher.PropertyValueTransformer) Entry(java.util.Map.Entry) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) ArrayList(java.util.ArrayList) Stack(java.util.Stack)

Example 4 with MongoPersistentEntity

use of org.springframework.data.mongodb.core.mapping.MongoPersistentEntity in project spring-data-mongodb by spring-projects.

the class MongoPersistentEntityIndexCreatorUnitTests method doesNotCreateIndexForEntityComingFromDifferentMappingContext.

@Test
public void doesNotCreateIndexForEntityComingFromDifferentMappingContext() {
    MongoMappingContext mappingContext = new MongoMappingContext();
    MongoMappingContext personMappingContext = prepareMappingContext(Person.class);
    MongoPersistentEntityIndexCreator creator = new MongoPersistentEntityIndexCreator(mappingContext, mongoTemplate);
    MongoPersistentEntity<?> entity = personMappingContext.getRequiredPersistentEntity(Person.class);
    MappingContextEvent<MongoPersistentEntity<?>, MongoPersistentProperty> event = new MappingContextEvent<MongoPersistentEntity<?>, MongoPersistentProperty>(personMappingContext, entity);
    creator.onApplicationEvent(event);
    verifyZeroInteractions(collection);
}
Also used : MappingContextEvent(org.springframework.data.mapping.context.MappingContextEvent) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) Test(org.junit.Test)

Example 5 with MongoPersistentEntity

use of org.springframework.data.mongodb.core.mapping.MongoPersistentEntity in project spring-data-mongodb by spring-projects.

the class MongoTemplate method findDistinct.

/*
	 * (non-Javadoc)
	 * @see org.springframework.data.mongodb.core.MongoOperations#findDistinct(org.springframework.data.mongodb.core.query.Query, java.lang.String, java.lang.String, java.lang.Class, java.lang.Class)
	 */
@Override
@SuppressWarnings("unchecked")
public <T> List<T> findDistinct(Query query, String field, String collectionName, Class<?> entityClass, Class<T> resultClass) {
    Assert.notNull(query, "Query must not be null!");
    Assert.notNull(field, "Field must not be null!");
    Assert.notNull(collectionName, "CollectionName must not be null!");
    Assert.notNull(entityClass, "EntityClass must not be null!");
    Assert.notNull(resultClass, "ResultClass must not be null!");
    MongoPersistentEntity<?> entity = entityClass != Object.class ? getPersistentEntity(entityClass) : null;
    Document mappedQuery = queryMapper.getMappedObject(query.getQueryObject(), entity);
    String mappedFieldName = queryMapper.getMappedFields(new Document(field, 1), entity).keySet().iterator().next();
    Class<T> mongoDriverCompatibleType = getMongoDbFactory().getCodecFor(resultClass).map(Codec::getEncoderClass).orElse((Class) BsonValue.class);
    MongoIterable<?> result = execute(collectionName, (collection) -> {
        DistinctIterable<T> iterable = collection.distinct(mappedFieldName, mappedQuery, mongoDriverCompatibleType);
        return query.getCollation().map(Collation::toMongoCollation).map(iterable::collation).orElse(iterable);
    });
    if (resultClass == Object.class || mongoDriverCompatibleType != resultClass) {
        MongoConverter converter = getConverter();
        DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory);
        result = result.map((source) -> converter.mapValueToTargetType(source, getMostSpecificConversionTargetType(resultClass, entityClass, field), dbRefResolver));
    }
    try {
        return (List<T>) result.into(new ArrayList<>());
    } catch (RuntimeException e) {
        throw potentiallyConvertRuntimeException(e, exceptionTranslator);
    }
}
Also used : Document(org.bson.Document) PropertyReferenceException(org.springframework.data.mapping.PropertyReferenceException) MongoDatabase(com.mongodb.client.MongoDatabase) PersistentPropertyAccessor(org.springframework.data.mapping.PersistentPropertyAccessor) Fields(org.springframework.data.mongodb.core.aggregation.Fields) ClientSession(com.mongodb.session.ClientSession) BulkOperationContext(org.springframework.data.mongodb.core.DefaultBulkOperations.BulkOperationContext) Optionals(org.springframework.data.util.Optionals) UpdateResult(com.mongodb.client.result.UpdateResult) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) MapReduceResults(org.springframework.data.mongodb.core.mapreduce.MapReduceResults) Resource(org.springframework.core.io.Resource) AggregationOperationContext(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext) ClassUtils(org.springframework.util.ClassUtils) NonNull(lombok.NonNull) NearQuery(org.springframework.data.mongodb.core.query.NearQuery) Mongo(com.mongodb.Mongo) AggregateIterable(com.mongodb.client.AggregateIterable) Aggregation(org.springframework.data.mongodb.core.aggregation.Aggregation) Cursor(com.mongodb.Cursor) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) CollectionUtils(org.springframework.util.CollectionUtils) 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) IndexOperationsProvider(org.springframework.data.mongodb.core.index.IndexOperationsProvider) MongoCollection(com.mongodb.client.MongoCollection) GroupByResults(org.springframework.data.mongodb.core.mapreduce.GroupByResults) MappingContext(org.springframework.data.mapping.context.MappingContext) Bson(org.bson.conversions.Bson) ProjectionInformation(org.springframework.data.projection.ProjectionInformation) AccessLevel(lombok.AccessLevel) MappingException(org.springframework.data.mapping.MappingException) ConvertingPropertyAccessor(org.springframework.data.mapping.model.ConvertingPropertyAccessor) Nullable(org.springframework.lang.Nullable) MongoSimpleTypes(org.springframework.data.mongodb.core.mapping.MongoSimpleTypes) com.mongodb.client.model(com.mongodb.client.model) ConversionService(org.springframework.core.convert.ConversionService) BeforeConvertEvent(org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent) AfterConvertEvent(org.springframework.data.mongodb.core.mapping.event.AfterConvertEvent) BeforeSaveEvent(org.springframework.data.mongodb.core.mapping.event.BeforeSaveEvent) ObjectUtils(org.springframework.util.ObjectUtils) TypedAggregation(org.springframework.data.mongodb.core.aggregation.TypedAggregation) IOException(java.io.IOException) BeansException(org.springframework.beans.BeansException) MongoMappingEventPublisher(org.springframework.data.mongodb.core.index.MongoMappingEventPublisher) Criteria(org.springframework.data.mongodb.core.query.Criteria) ResourceUtils(org.springframework.util.ResourceUtils) DistinctIterable(com.mongodb.client.DistinctIterable) DBCursor(com.mongodb.DBCursor) MongoMappingEvent(org.springframework.data.mongodb.core.mapping.event.MongoMappingEvent) MongoIterable(com.mongodb.client.MongoIterable) org.springframework.data.mongodb.core.convert(org.springframework.data.mongodb.core.convert) JSONParseException(com.mongodb.util.JSONParseException) RequiredArgsConstructor(lombok.RequiredArgsConstructor) LoggerFactory(org.slf4j.LoggerFactory) CloseableIterator(org.springframework.data.util.CloseableIterator) 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) MapReduceOptions(org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) Pair(org.springframework.data.util.Pair) MapReduceIterable(com.mongodb.client.MapReduceIterable) Update(org.springframework.data.mongodb.core.query.Update) StreamUtils(org.springframework.data.util.StreamUtils) Meta(org.springframework.data.mongodb.core.query.Meta) ResourceLoader(org.springframework.core.io.ResourceLoader) MongoPersistentEntityIndexCreator(org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator) SerializationUtils(org.springframework.data.mongodb.core.query.SerializationUtils) MongoException(com.mongodb.MongoException) ApplicationListener(org.springframework.context.ApplicationListener) AggregationResults(org.springframework.data.mongodb.core.aggregation.AggregationResults) Collectors(java.util.stream.Collectors) FindIterable(com.mongodb.client.FindIterable) Entry(java.util.Map.Entry) Codec(org.bson.codecs.Codec) TypeBasedAggregationOperationContext(org.springframework.data.mongodb.core.aggregation.TypeBasedAggregationOperationContext) 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) BulkMode(org.springframework.data.mongodb.core.BulkOperations.BulkMode) InvalidDataAccessApiUsageException(org.springframework.dao.InvalidDataAccessApiUsageException) Distance(org.springframework.data.geo.Distance) IndexOperations(org.springframework.data.mongodb.core.index.IndexOperations) EntityReader(org.springframework.data.convert.EntityReader) AfterLoadEvent(org.springframework.data.mongodb.core.mapping.event.AfterLoadEvent) MongoCursor(com.mongodb.client.MongoCursor) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) GroupBy(org.springframework.data.mongodb.core.mapreduce.GroupBy) ApplicationEventPublisherAware(org.springframework.context.ApplicationEventPublisherAware) Logger(org.slf4j.Logger) AggregationOptions(org.springframework.data.mongodb.core.aggregation.AggregationOptions) ConnectionCallback(org.springframework.jca.cci.core.ConnectionCallback) DBCollection(com.mongodb.DBCollection) ApplicationContext(org.springframework.context.ApplicationContext) Query(org.springframework.data.mongodb.core.query.Query) TimeUnit(java.util.concurrent.TimeUnit) AfterSaveEvent(org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent) ClientSessionOptions(com.mongodb.ClientSessionOptions) GeoResults(org.springframework.data.geo.GeoResults) MongoClient(com.mongodb.MongoClient) DeleteResult(com.mongodb.client.result.DeleteResult) AllArgsConstructor(lombok.AllArgsConstructor) GeoResult(org.springframework.data.geo.GeoResult) WriteConcern(com.mongodb.WriteConcern) Assert(org.springframework.util.Assert) StringUtils(org.springframework.util.StringUtils) Document(org.bson.Document) Collation(org.springframework.data.mongodb.core.query.Collation) BsonValue(org.bson.BsonValue)

Aggregations

MongoPersistentEntity (org.springframework.data.mongodb.core.mapping.MongoPersistentEntity)10 MongoPersistentProperty (org.springframework.data.mongodb.core.mapping.MongoPersistentProperty)9 Document (org.bson.Document)7 MongoMappingContext (org.springframework.data.mongodb.core.mapping.MongoMappingContext)7 Assert (org.springframework.util.Assert)6 ClassUtils (org.springframework.util.ClassUtils)6 StringUtils (org.springframework.util.StringUtils)6 UpdateResult (com.mongodb.client.result.UpdateResult)5 Entry (java.util.Map.Entry)5 Bson (org.bson.conversions.Bson)5 DeleteResult (com.mongodb.client.result.DeleteResult)4 ClientSession (com.mongodb.session.ClientSession)4 JSONParseException (com.mongodb.util.JSONParseException)4 java.util (java.util)4 Collectors (java.util.stream.Collectors)4 RequiredArgsConstructor (lombok.RequiredArgsConstructor)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 DataAccessException (org.springframework.dao.DataAccessException)4 InvalidDataAccessApiUsageException (org.springframework.dao.InvalidDataAccessApiUsageException)4