'How to count query with hint on Spring mongoTemplate?

...
Query query = new Query().addCriteria(...);

query.withHint("Index name");

mongoTemplate.count(query, MyClass.class);
...

This count query code doesn't seem to apply hint.

How can I apply index hint to count query on MongoTemplate?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source