[SERVER-44376] Indexed $gte/lte does not produce superset of results returned by $eq for 'undefined' values Created: 01/Nov/19  Updated: 27/Oct/23  Resolved: 16/Nov/19

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

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: Ian Boros
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-37164 Incorrect query results on $gte null ... Backlog
Operating System: ALL
Sprint: Query 2019-12-02
Participants:

 Description   

{$eq: null} returns true for missing, null and undefined values. Our index bounds generation does not include 'undefined' for predicates like {$gte: null} (or $lte).

db.c.insert({a: null})
db.c.insert({a: undefined})
db.c.find({a: {$gte: null}})
// Returns both documents inserted
db.c.createIndex({a: 1})
db.c.find({a: {$gte: null}})
// Only returns the document containing 'null' because bounds generated are only for [null, null]



 Comments   
Comment by Ian Boros [ 16/Nov/19 ]

Fixed under SERVER-44377.

Comment by David Storch [ 04/Nov/19 ]

ian.boros, I'm flagging this for scheduling, since in general new ticket should not go directly to the backlog.

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