I’ve a mongo collection having around 550,000 documents. Document has an array field path on which i have a below query in my java code. This field is indexed.
Problem is ids in below query can go up to 6000 causing the query to take ~8 secs. Tried to use aggregator to bring it down but no luck.
Could some one please guide here what else can be done.
Query query = new Query(Criteria.where("ancestors").is(null).and("path").in(ids));
var data = mongoTemplate.findDistinct(query, "path", Orders.class, String.class);