Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm fetching records of around 1200 records, if I query it from Mongo Compass, it uses the Compound Index which I created, and from 20ms(without indexing) to 0ms the performance shows, but If I use the same query in my Spring Boot Java project using Document class and using the below query, it takes up to 2 secs to fetch the same record.

To create indexes I used to db.collectionName.createIndex()

Below is the Java Spring Data Query

@Query(value="{country:?0, age: ?1}",fields="{'name':1,'state':1}")
public List<Object> getcountrySpecificName(String country, String name);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
561 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...