sql >> Databasteknik >  >> NoSQL >> MongoDB

MongoDB Långsam fråga efter ID

Hittade problemet när jag chattade med en MongoDB-utvecklare:Jag körde spring framework 4.0.0 och långsamheten är relaterad till detta problem:

https://jira.spring.io/browse/SPR-11335

Att uppdatera Spring till version 4.0.1 (eller senare) löser problemet.

Det här var stackspåret från mitt samtal till problemet:

    at java.lang.Class.getGenericSignature(Native Method)
    at java.lang.Class.getGenericInterfaces(Class.java:813)
    at org.springframework.core.SerializableTypeWrapper$2.getType(SerializableTypeWrapper.java:106)
    at org.springframework.core.SerializableTypeWrapper$TypeProxyInvocationHandler.invoke(SerializableTypeWrapper.java:220)
    at com.sun.proxy.$Proxy5.equals(Unknown Source)
    at org.springframework.util.ObjectUtils.nullSafeEquals(ObjectUtils.java:252)
    at org.springframework.core.ResolvableType.equals(ResolvableType.java:682)
    at org.springframework.util.ObjectUtils.nullSafeEquals(ObjectUtils.java:252)
    at org.springframework.core.ResolvableType.variableResolverSourceEquals(ResolvableType.java:719)
    at org.springframework.core.ResolvableType.equals(ResolvableType.java:683)
    at org.springframework.util.ConcurrentReferenceHashMap$Segment.findInChain(ConcurrentReferenceHashMap.java:571)
    at org.springframework.util.ConcurrentReferenceHashMap$Segment.getReference(ConcurrentReferenceHashMap.java:439)
    at org.springframework.util.ConcurrentReferenceHashMap.getReference(ConcurrentReferenceHashMap.java:238)
    at org.springframework.util.ConcurrentReferenceHashMap.get(ConcurrentReferenceHashMap.java:217)
    at org.springframework.core.ResolvableType.forType(ResolvableType.java:1018)
    at org.springframework.core.ResolvableType.forType(ResolvableType.java:998)
    at org.springframework.core.ResolvableType.getGenerics(ResolvableType.java:489)
    at org.springframework.core.ResolvableType.getGeneric(ResolvableType.java:451)
    at org.springframework.core.convert.TypeDescriptor.getElementTypeDescriptor(TypeDescriptor.java:305)
    at org.springframework.core.convert.TypeDescriptor.equals(TypeDescriptor.java:456)
    at org.springframework.util.ObjectUtils.nullSafeEquals(ObjectUtils.java:252)
    at org.springframework.core.convert.support.GenericConversionService$ConverterCacheKey.equals(GenericConversionService.java:436)
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:996)
    at org.springframework.core.convert.support.GenericConversionService.getConverter(GenericConversionService.java:235)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:162)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getPotentiallyConvertedSimpleRead(MappingMongoConverter.java:715)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readCollectionOrArray(MappingMongoConverter.java:773)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1048)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$100(MappingMongoConverter.java:77)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:999)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:755)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:256)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:249)
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:261)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:249)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:223)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:183)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:77)
    at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1966)
    at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1662)
    at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1487)
    at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1471)
    at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527)
    at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:518)
    at com.sytrue.record.persistence.repo.impl.RecordRepositoryImpl.findAsMapIds(RecordRepositoryImpl.java:139)


  1. Hitta värden som inte innehåller siffror i SQL

  2. Uppdatera flera underdokument utan exakt villkor på underdokumentnivå

  3. MongoDB:Problem när du använder mongoexport med --query-alternativet

  4. Hur sorterar och begränsar man resultat i mongodb?