[SERVER-38974] How to force a mongodb mapreduce query to use a specific index (similar to '$hint')? Created: 14/Jan/19  Updated: 06/Dec/22  Resolved: 15/Jan/19

Status: Closed
Project: Core Server
Component/s: Index Maintenance, MapReduce, Querying
Affects Version/s: 4.0.5
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: RS Assignee: Backlog - Triage Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-10087 provide index hinting within MapReduce Closed
Assigned Teams:
Server Triage
Participants:

 Description   

Hi,

we run thousands of mapreduce jobs in mongodb every day. Unfortunately mongodb sometimes uses the wrong index to perform these.

Is there any way to pass a '$hint' flag to a mapreduce query ?

Thanks
 



 Comments   
Comment by Danny Hatcher (Inactive) [ 15/Jan/19 ]

Hello,

The mapReduce command does not currently support hints. SERVER-10087 tracks the feature request. However, the aggregate command does support hints and can be a very powerful alternative to mapReduce. You may wish to investigate the possibility of using it in your application.

Thank you,

Danny

Generated at Thu Feb 08 04:50:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.