[DRIVERS-1393] Support authorizedCollections option for listCollections helpers Created: 08/Sep/20  Updated: 13/Feb/23

Status: Implementing
Project: Drivers
Component/s: listCollections
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Jérôme Mainaud Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-32942 mongo shell: for users authorized to ... Closed
is depended on by JAVA-4302 Update options for ListCollectionsIte... Blocked
Issue split
split to MOTOR-835 Support authorizedCollections option ... Closed
split to PYTHON-2950 Support authorizedCollections option ... Closed
split to CDRIVER-4191 Support authorizedCollections option ... Backlog
split to CXX-2392 Support authorizedCollections option ... Backlog
split to RUST-1063 Support authorizedCollections option ... Backlog
split to CSHARP-3918 Support authorizedCollections option ... Closed
split to GODRIVER-2190 Support authorizedCollections option ... Closed
split to JAVA-4353 Support authorizedCollections option ... Closed
split to NODE-3687 Support authorizedCollections option ... Closed
split to PHPLIB-740 Support authorizedCollections option ... Closed
split to RUBY-2814 Support authorizedCollections option ... Closed
Related
related to DRIVERS-685 Support for 'authorizedDatabases' option Implementing
is related to SERVER-32942 mongo shell: for users authorized to ... Closed
Driver Changes: Needed
Server Compat: 4.0
Quarter: FY22Q4
Downstream Changes Summary:

Drivers should sync with mongodb/specifications@15302d2 which introduced the authorizedCollections option to the three listCollections methods: listCollections, listCollectionNames, listMongoCollections.

 

Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-4191 Backlog
CXX-2392 Backlog
CSHARP-3918 Fixed 2.15.0
GODRIVER-2190 Done 1.9.0
JAVA-4353 Done 5.0.0
NODE-3687 Duplicate
PHPLIB-740 Fixed 1.12.0
PYTHON-2950 Works as Designed
MOTOR-835 Works as Designed
RUBY-2814 Fixed 2.18.0
RUST-1063 Backlog
SWIFT-1377 Fixed 1.4.0

 Description   

MongoDB 4.0 added an authorizedCollections boolean option to the listCollections command, which can be used to limit the command result to collections the user is authorized to use.

This ticket should allow the users to set the authorizedCollections option on the listCollections, listCollectionNames, and listMongoCollections driver methods.



 Comments   
Comment by Githook User [ 16/Dec/21 ]

Author:

{'name': 'Neil Shweky', 'email': 'neilshweky@gmail.com', 'username': 'Neilshweky'}

Message: DRIVERS-1393 listCollectionNames should use authorizedCollections argument (#1111)

Comment by Jeremy Mikola [ 15/Dec/21 ]

Per alexander.golin's previous comment:

whatever we've done to support "authorizedDatabases" we should also do here.

The related spec change for the listDatabases helpers was mongodb/specifications@4d12e63 for SPEC-1342. Note that this option was introduced in a server's patch release (4.0.5), so it's not really feasible to check for server support using a wire version as we do for other options. According to this code comment from PHPLIB, servers before 4.0.5 ignore the option (as opposed to raising an error), but I haven't personally verified that.

With respect to DRIVERS-685 and SPEC-1342, we should note that the default behavior for drivers is to not specify the option and only include the option in the outgoing command when it is specified by the user. Support for the option was added to all three listDatabases helpers.

With respect to this issue, I think we should do the same. All three helpers for listCollections should add support for the option. The default behavior should be to leave it unspecified and only send it in the outgoing command when it is specified by the user. The spec change for listDatabases doesn't talk about checking for server-side support, so I think we don't have to worry about that here. Drivers can just document the server version that introduced the option and leave this up to our users.

Comment by Jérôme Mainaud [ 17/Sep/20 ]

Hello,
Thank you for your feedback.
Indeed, having a consistent behaviour between drivers is certainly something you should do.

Comment by Esha Bhargava [ 15/Sep/20 ]

jmainaud@zeenea.com Thanks for reporting this issue! We have moved this to the DRIVERS project to discuss if this is something we should do for all our drivers.

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