[DOCS-16012] [Server] Investigate changes in SERVER-68922: $natural parser should be stricter (reject NaN, etc) Created: 05/Apr/23  Updated: 13/Nov/23  Resolved: 05/Apr/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 7.0.0-rc0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-68922 $natural parser should be stricter (r... Closed
Participants:
Days since reply: 44 weeks ago

 Description   
Original Downstream Change Summary

This change brings the server-side validation in line with what we say that we accept in our public documentation (see https://www.mongodb.com/docs/manual/reference/method/cursor.hint/#std-label-hint-collection-scans), so there should not be any documentation changes needed. However, sending downstream impact tickets to notify that we will now reject invalid inputs rather than interpreting them non-sensically.

Description of Linked Ticket

A $natural hint or sort is supposed to take a direction: +1 or -1. But the parser allows other values, such as 0, NaN, or -0.01. In 5.0 and later we define safeNumberInt() < 0 to mean descending, which means 0, NaN and -0.01 are ascending. In 4.4 and earlier we use the unsafe numberInt(), so whether NaN is ascending or descending depends on the platform.

We should reject all of these inputs with a clear error. We should also consider using the number() < 0 idiom for consistency with index keys and sort patterns.

It looks like this doesn't affect other hints and sorts, because we either validate the SortPattern, or check that the hint matches to an existing index key.



 Comments   
Comment by Sarah Olson [ 05/Apr/23 ]

Thanks David! Appreciate the quick response. 

Comment by David Percy [ 05/Apr/23 ]

That sounds fine to me.  Thanks!

Comment by Sarah Olson [ 05/Apr/23 ]

david.percy@mongodb.com, davis.haupt@mongodb.com, I'm inclined to close this ticket, based on the downstream changes description stating that no doc updates are really required. Any concerns with this course of action? Thanks very much in advance. 

Generated at Thu Feb 08 08:14:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.