[SERVER-74349] Fix TypeError: db.getDB is not a function Created: 24/Feb/23  Updated: 29/Oct/23  Resolved: 25/Feb/23

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

Type: Bug Priority: Major - P3
Reporter: Alexander Ignatyev Assignee: Alexander Ignatyev
Resolution: Fixed Votes: 0
Labels: M4
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QO 2023-03-06
Participants:
Linked BF Score: 60

 Description   

FeatureFlagUtil.isPresentAndEnabled() fails in the catch block inside if the object passed to it in is not Mongo object. We should pass `db.getMongo()` instead of just `db`:

        try {
            setConn(db);
        } catch (err) {
            // Some db-like objects (e.g. ShardingTest.shard0) aren't supported by FixtureHelpers,
            // but we can replace it with an object that should work and try again.
            setConn(db.getDB(db.defaultDB));
        }

Other callees of the function pass db.getMongo() as well.



 Comments   
Comment by Githook User [ 24/Feb/23 ]

Author:

{'name': 'Alexander Ignatyev', 'email': 'alexander.ignatyev@mongodb.com', 'username': 'aligusnet'}

Message: SERVER-74349 Pass Mongo object to FeatureFlagUtil.isPresentAndEnabled instead of database in CWI tests
Branch: master
https://github.com/mongodb/mongo/commit/afae7c47d5cd4d90968fa93b56b7c16f45d25930

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