[SERVER-67510] [CQF] Query using range predicate on descending index does not return correct results Created: 24/Jun/22  Updated: 29/Oct/23  Resolved: 04/Aug/22

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

Type: Bug Priority: Major - P3
Reporter: Nicholas Zolnierz Assignee: Daniel Segel
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QO 2022-07-11, QO 2022-07-25, QO 2022-08-08
Participants:

 Description   

This bug is related to CQF/bonsai only.

coll.insertOne({a: 1});
coll.createIndex({a: -1});
const res = coll.find({a : {$gte: 0, $lte: 2}}).toArray();

The query above should always return the one document but instead sometimes returns nothing, dependent on which plan is chosen and if the index is used. Note that if

for (i = 0; i < 100; ++i) coll.insert({}) 

is added, a plan using the descending index will always be chosen, and the query will return no results.



 Comments   
Comment by Githook User [ 04/Aug/22 ]

Author:

{'name': 'Daniel Segel', 'email': 'daniel_segel@brown.edu', 'username': 'dhsegel'}

Message: SERVER-67510 Fix descending index on range predicate bug
Branch: master
https://github.com/mongodb/mongo/commit/112d3349db7bb2bc1bb7f6a6cdd7dd1d89f3f423

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