[SERVER-85500] $hint is not validated when collection does not exist Created: 19/Jan/24  Updated: 01/Feb/24  Resolved: 31/Jan/24

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

Type: Bug Priority: Major - P3
Reporter: Chris Wolff Assignee: Chris Harris
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-85532 Make shape helpers robust to invalid ... Closed
Assigned Teams:
Query Integration
Operating System: ALL
Participants:
Linked BF Score: 30

 Description   

Recently, BF-31428 occurred because a query with an invalid $hint was executed. $hint is supposed to be a string or an object, but in this case it was a double.

This caused the above issue with query stats since it reasonably does not expect that syntactically invalid statements will be executed. I think the fix there is to make query stats more robust to this, but the behavior of $hint remains confusing.

This is easy to reproduce from the Mongo shell:

db.nonexistant.find().hint({$hint: -1})

This command succeeds even though $hint has the wrong type.


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