Skip to content

Commit bb7a81f

Browse files
authored
PYTHON-5900 - Clarify Cursor and CommandCursor docstrings to indicate… (mongodb#2900)
1 parent 19fd1b1 commit bb7a81f

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

pymongo/asynchronous/command_cursor.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""CommandCursor class to iterate over command results."""
15+
"""AsyncCommandCursor class to iterate over command results."""
1616

1717
from __future__ import annotations
1818

@@ -42,7 +42,18 @@
4242

4343

4444
class AsyncCommandCursor(_AsyncCursorBase[_DocumentType]):
45-
"""An asynchronous cursor / iterator over command cursors."""
45+
"""An asynchronous cursor / iterator over command cursors.
46+
Used by :meth:`~pymongo.asynchronous.collection.AsyncCollection.aggregate`,
47+
:meth:`~pymongo.asynchronous.database.AsyncDatabase.aggregate`,
48+
:meth:`~pymongo.asynchronous.collection.AsyncCollection.list_indexes`,
49+
:meth:`~pymongo.asynchronous.collection.AsyncCollection.list_search_indexes`
50+
:meth:`~pymongo.asynchronous.database.AsyncDatabase.list_collections`,
51+
:meth:`~pymongo.asynchronous.database.AsyncDatabase.cursor_command`,
52+
and :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.list_databases`
53+
to iterate MongoDB command results.
54+
55+
Should not be called directly by application developers.
56+
"""
4657

4758
_getmore_class = _GetMore
4859

pymongo/asynchronous/cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def __init__(
9797
let: Optional[bool] = None,
9898
) -> None:
9999
"""Create a new cursor.
100+
Used by :meth:`~pymongo.asynchronous.collection.AsyncCollection.find` to iterate over MongoDB query results.
100101
101-
Should not be called directly by application developers - see
102-
:meth:`~pymongo.asynchronous.collection.AsyncCollection.find` instead.
102+
Should not be called directly by application developers.
103103
104104
.. seealso:: The MongoDB documentation on `cursors <https://dochub.mongodb.org/core/cursors>`_.
105105
"""

pymongo/synchronous/command_cursor.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,18 @@
4242

4343

4444
class CommandCursor(_CursorBase[_DocumentType]):
45-
"""A cursor / iterator over command cursors."""
45+
"""A cursor / iterator over command cursors.
46+
Used by :meth:`~pymongo.collection.Collection.aggregate`,
47+
:meth:`~pymongo.database.Database.aggregate`,
48+
:meth:`~pymongo.collection.Collection.list_indexes`,
49+
:meth:`~pymongo.collection.Collection.list_search_indexes`
50+
:meth:`~pymongo.database.Database.list_collections`,
51+
:meth:`~pymongo.database.Database.cursor_command`,
52+
and :meth:`~pymongo.mongo_client.MongoClient.list_databases`
53+
to iterate MongoDB command results.
54+
55+
Should not be called directly by application developers.
56+
"""
4657

4758
_getmore_class = _GetMore
4859

pymongo/synchronous/cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def __init__(
9797
let: Optional[bool] = None,
9898
) -> None:
9999
"""Create a new cursor.
100+
Used by :meth:`~pymongo.collection.Collection.find` to iterate over MongoDB query results.
100101
101-
Should not be called directly by application developers - see
102-
:meth:`~pymongo.collection.Collection.find` instead.
102+
Should not be called directly by application developers.
103103
104104
.. seealso:: The MongoDB documentation on `cursors <https://dochub.mongodb.org/core/cursors>`_.
105105
"""

0 commit comments

Comments
 (0)