Answers for "mongodb spring boot index usage 0"

1

mongodb spring boot index usage 0

spring.data.mongodb.auto-index-creation = true
Posted by: Guest on March-16-2021
0

mongodb spring boot index usage 0

@Configuration
public class Config extends AbstractMongoClientConfiguration {

	@Override
    protected boolean autoIndexCreation() {               
        return true;
    }

    // ...
}
Posted by: Guest on March-16-2021
0

mongodb spring boot index usage 0

MongoDatabaseFactory dbFactory = new SimpleMongoClientDatabaseFactory(...);
DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(dbFactory);

MongoMappingContext mappingContext = new MongoMappingContext();
mappingContext.setAutoIndexCreation(true);                
// ...
mappingContext.afterPropertiesSet();

MongoTemplate template = new MongoTemplate(dbFactory, new MappingMongoConverter(dbRefResolver, mappingContext));
Posted by: Guest on March-16-2021

Browse Popular Code Answers by Language