[SERVER-71806] Review/fix usages of `ChunkRange::extractKeyPattern` and `Helpers::inferKeyPattern` Created: 02/Dec/22  Updated: 26/Oct/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Pierlauro Sciarelli Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: oldshardingemea, shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Catalog and Routing
Operating System: ALL
Sprint: Sharding EMEA 2023-01-23, Sharding EMEA 2023-02-20, Sharding EMEA 2023-03-06, Sharding EMEA 2023-05-01, Sharding EMEA 2023-05-15
Participants:
Story Points: 3

 Description   

Both extractKeyPattern and inferKeyPattern wrongly assume that no field in a shard key can be hashed.

Given a document, they simply generate a key pattern by setting at 1 all the values of the fields.

Examples:

Real shard key pattern Document Inferred/extracted key pattern  
{x:1, y:1} {x: 12345, y: 67890} {x:1, y:1} Correct
{x:hashed, y:1} {x: 12345, y: 67890} {x:1, y:1} Wrong

Generated at Thu Feb 08 06:20:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.