[SERVER-14951] DBClientWithCommands::getCollectionInfos fails against mongodb < 2.7 Created: 19/Aug/14  Updated: 08/Sep/14  Resolved: 22/Aug/14

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: None
Fix Version/s: 2.7.6

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-311 Backport 540f9ec and associated fix f... Closed
Tested
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

this works against mongodb 2.7:

> db.runCommand({ listCollections : 1, filter : { name : "dbclient" } })
{
	"collections" : [
		{
			"name" : "dbclient",
			"options" : {
 
			}
		}
	],
	"ok" : 1
}

But the fallback code in the driver when running against a <2.7 server which does not offer the listCollections command attempts to query system.indexes with the same filter:

> db.system.namespaces.find({name : "dbclient"}) 

That doesn't match, because in system.namespaces the names are db qualified:

> db.system.namespaces.find({name : "test.dbclient"})
{ "name" : "test.dbclient" }

So the fallback code will need to make a new BSONObj that db qualifies any 'name' element in the filter.

Marking this ticket "driver changes needed" since fix will need to be backported to the legacy C++ driver.



 Comments   
Comment by Adam Midvidy [ 22/Aug/14 ]

while tests were not added to the server repository (the method in question is not exposed via the mongo shell, making it impossible to write a jstest) the change was validated by the C++ driver CI suite.

Comment by Githook User [ 22/Aug/14 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-14951 fix getCollectionInfos to qualify name with db for legacy mongo versions

Closes #754

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/4752092258fd5868147b8cece636d2fd41c79305

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