[SERVER-12917] Equality queries on _id ignore $natural sort Created: 26/Feb/14  Updated: 10/Dec/14  Resolved: 03/Mar/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.6.0-rc0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

$natural hint is obeyed:

> db.foo.find({_id:1}).hint({$natural:1}).explain().cursor
BasicCursor

But $natural sort isn't:

> db.foo.find({_id:1}).sort({$natural:1}).explain().cursor
BtreeCursor _id_



 Comments   
Comment by J Rassi [ 03/Mar/14 ]

I was under the impression that the semantics for $natural hint and $natural sort were equivalent: force a collection scan. Given your disagreement, I'll consider that assumption incorrect.

Resolving works-as-designed.

Comment by Eliot Horowitz (Inactive) [ 28/Feb/14 ]

I'm not sure why would expect it to be.
Perfectly valid to use the _id index and then do an in memory sort of 1 element.

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