[SERVER-60533] Distinct preceded by sharded collection drop fails with "database not found" Created: 07/Oct/21  Updated: 29/Oct/23  Resolved: 14/Jan/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.3, 4.2.17, 4.4.10, 5.1.0-rc0
Fix Version/s: 5.3.0, 5.2.2

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
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.2, v5.1, v5.0, v4.4, v4.2
Steps To Reproduce:

(On a sharded cluster, e.g. run mlaunch-cluster and connect with mongo shell)
coll = db.getCollection("collName")
coll.drop()
coll.distinct("a") // fails with "database not found"

Participants:
Linked BF Score: 10

 Description   

The distinct command does not ensure that the database exists before attempting to run.



 Comments   
Comment by Githook User [ 10/Mar/22 ]

Author:

{'name': 'Alya Berciu', 'email': 'alyacarina@gmail.com', 'username': 'alyacb'}

Message: SERVER-60533 Return empty result in distinct when database not found
Branch: v5.2
https://github.com/mongodb/mongo/commit/b42523b2e4902b1c51963bd9a845ba9484e043fd

Comment by Githook User [ 14/Jan/22 ]

Author:

{'name': 'Alya Berciu', 'email': 'alyacarina@gmail.com', 'username': 'alyacb'}

Message: SERVER-60533 Return empty result in distinct when database not found
Branch: master
https://github.com/mongodb/mongo/commit/5ea5ed31fdf79e67fb2fea5ff3e3441f77fd52f6

Comment by Githook User [ 03/Dec/21 ]

Author:

{'name': 'Alya Berciu', 'email': 'alyacarina@gmail.com', 'username': 'alyacb'}

Message: Revert "SERVER-60533 Ensure db exists in distinct command"
Branch: master
https://github.com/mongodb/mongo/commit/eaa1e441a67f142d420f6f5187527f7dc05e2d05

Comment by Githook User [ 22/Nov/21 ]

Author:

{'name': 'Alya Berciu', 'email': 'alyacarina@gmail.com', 'username': 'alyacb'}

Message: SERVER-60533 Ensure db exists in distinct command
Branch: master
https://github.com/mongodb/mongo/commit/7a9101652b4de3b4ef4f57c84e68d09eae793413

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