[SERVER-70436] Restrict cases where isCoveredNullQuery can apply Created: 11/Oct/22  Updated: 29/Oct/23  Resolved: 04/Nov/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.1, 6.0.3, 6.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Alya Berciu Assignee: Alya Berciu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Minor Change
Operating System: ALL
Backport Requested:
v6.1, v6.0
Steps To Reproduce:

See HELP-38275.

There is an additional case where we run into a similar problem:

db.coll.insertMany([{_id: 1, "a" : [ 1, 2, 3 ] }, {_id: 2, a: null}])

db.coll.aggregate({$match: {a: {$in: [[2], null, []]}}}, {$project: {_id: 1}}) -> returns {_id: 2}

db.coll.createIndex({a: 1})

db.coll.aggregate({$match: {a: {$in: [[2], null, []]}}}, {$project: {_id: 1}}) -> returns {_id: 1} and {_id: 2}

Sprint: QO 2022-10-17, QO 2022-10-31, QO 2022-11-14
Participants:
Case:

 Description   

There are additional cases where we cannot use an index to cover a null query when we have multiple clauses in $or or $in. We should make sure to add a FETCH stage above the index scan when the index scan bounds are not exact for the non-null part of the predicate, even if we can cover the null part of the query.



 Comments   
Comment by Githook User [ 08/Nov/22 ]

Author:

{'name': 'Alya Berciu', 'email': 'alya.berciu@mongodb.com', 'username': 'alyacb'}

Message: SERVER-70436 Handle covered $or null queries with regex
Branch: v6.0
https://github.com/mongodb/mongo/commit/7e3381f8a26e6bb01d4715961f6babadff651de0

Comment by Githook User [ 08/Nov/22 ]

Author:

{'name': 'Alya Berciu', 'email': 'alya.berciu@mongodb.com', 'username': 'alyacb'}

Message: SERVER-70436 Handle covered $or null queries with regex
Branch: v6.1
https://github.com/mongodb/mongo/commit/1d7d31af73e667c1f65a162a39b7b27eec11e570

Comment by Githook User [ 04/Nov/22 ]

Author:

{'name': 'Alya Berciu', 'email': 'alya.berciu@mongodb.com', 'username': 'alyacb'}

Message: SERVER-70436 Handle covered $or null queries with regex
Branch: master
https://github.com/mongodb/mongo/commit/ca6499eb6111f89758fcb71b319e8b5d0cd03a20

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