Skip to content

Commit 15302d2

Browse files
authored
DRIVERS-1393 listCollectionNames should use authorizedCollections argument (#1111)
* DRIVERS-1393 add authorizedCollections to the spec * DRIVERS-1393 update docs after Jeremy's clarifications * DRIVERS-1393 update language, move paragraphs around * DRIVERS-1393 minor language change
1 parent c2e00b7 commit 15302d2

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

source/enumerate-collections.rst

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,17 @@ Example return::
284284

285285

286286
Server version between 2.7.6 (inclusive) and 4.0 (exclusive) do not support
287-
the ``nameOnly`` option for the ``listCollections`` command and will ignore it
288-
without raising an error. Therefore, drivers MUST always specify the ``nameOnly``
289-
option when they only intend to access collection names from the ``listCollections``
287+
the ``nameOnly`` option for the ``listCollections`` command and will ignore it
288+
without raising an error. Therefore, drivers MUST always specify the ``nameOnly``
289+
option when they only intend to access collection names from the ``listCollections``
290290
command result, except drivers MUST NOT set ``nameOnly`` if a filter
291291
specifies any keys other than ``name``.
292292

293+
MongoDB 4.0 also added an ``authorizedCollections`` boolean option to the ``listCollections``
294+
command, which can be used to limit the command result to only include collections
295+
the user is authorized to use. Drivers MAY allow users to set the ``authorizedCollections``
296+
option on the ``listCollectionNames`` method.
297+
293298
Getting Full Collection Information
294299
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295300

@@ -342,7 +347,8 @@ Example return (a cursor which returns documents, not a simple array)::
342347
When returning this information as a cursor, a driver SHOULD use the
343348
method name ``listCollections`` or an idiomatic variant.
344349

345-
Drivers MAY allow ``nameOnly`` option to be passed when executing the ``listCollections`` command for this method.
350+
Drivers MAY allow the ``nameOnly`` and ``authorizedCollections`` options
351+
to be passed when executing the ``listCollections`` command for this method.
346352

347353
Returning a List of Collection Objects
348354
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -362,8 +368,12 @@ Example return (in PHP, but abbreviated)::
362368
[5] => class MongoCollection#11 { }
363369
}
364370

365-
Drivers MUST specify the ``nameOnly`` option when executing the ``listCollections`` command for this method,
366-
except drivers MUST NOT set ``nameOnly`` if a filter specifies any keys other than ``name``.
371+
Drivers MUST specify true for the ``nameOnly`` option when executing the
372+
``listCollections`` command for this method, except drivers MUST NOT set
373+
``nameOnly`` if a filter specifies any keys other than ``name``.
374+
375+
Drivers MAY allow the ``authorizedCollections`` option to be passed when
376+
executing the ``listCollections`` command for this method
367377

368378
Replica Sets
369379
~~~~~~~~~~~~
@@ -433,6 +443,9 @@ The shell implements the first algorithm for falling back if the
433443

434444
Version History
435445
===============
446+
Version 0.7.0 Changes
447+
- Support ``authorizedCollections`` option in ``listCollections`` command.
448+
436449
Version 0.6.1 Changes
437450
- Update to use secondaryOk.
438451

@@ -449,7 +462,7 @@ Version 0.5 Changes
449462
- Clarify that ``nameOnly`` must not be used with filters other than ``name``.
450463

451464
Version 0.4 Changes
452-
- SPEC-1066: Support ``nameOnly`` option in ``listCollections`` command.
465+
- SPEC-1066: Support ``nameOnly`` option in ``listCollections`` command.
453466

454467
Version 0.3.1 Changes
455468

0 commit comments

Comments
 (0)