Skip to content

Commit a72820f

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents 0a40d12 + bf12e97 commit a72820f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+580
-60
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:mod:`change_stream` -- Watch changes on a collection, database, or cluster
2+
===========================================================================
3+
4+
.. automodule:: pymongo.asynchronous.change_stream
5+
:members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:mod:`client_session` -- Logical sessions for sequential operations
2+
===================================================================
3+
4+
.. automodule:: pymongo.asynchronous.client_session
5+
:members:
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
:mod:`collection` -- Collection level operations
2+
================================================
3+
4+
.. automodule:: pymongo.asynchronous.collection
5+
:synopsis: Collection level operations
6+
7+
.. autoclass:: pymongo.asynchronous.collection.ReturnDocument
8+
9+
.. autoclass:: pymongo.asynchronous.collection.AsyncCollection(database, name, create=False, **kwargs)
10+
11+
.. describe:: c[name] || c.name
12+
13+
Get the `name` sub-collection of :class:`AsyncCollection` `c`.
14+
15+
Raises :class:`~pymongo.asynchronous.errors.InvalidName` if an invalid
16+
collection name is used.
17+
18+
.. autoattribute:: full_name
19+
.. autoattribute:: name
20+
.. autoattribute:: database
21+
.. autoattribute:: codec_options
22+
.. autoattribute:: read_preference
23+
.. autoattribute:: write_concern
24+
.. autoattribute:: read_concern
25+
.. automethod:: with_options
26+
.. automethod:: bulk_write
27+
.. automethod:: insert_one
28+
.. automethod:: insert_many
29+
.. automethod:: replace_one
30+
.. automethod:: update_one
31+
.. automethod:: update_many
32+
.. automethod:: delete_one
33+
.. automethod:: delete_many
34+
.. automethod:: aggregate
35+
.. automethod:: aggregate_raw_batches
36+
.. automethod:: watch
37+
.. automethod:: find(filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, batch_size=0, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, session=None, allow_disk_use=None)
38+
.. automethod:: find_raw_batches(filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, batch_size=0, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, session=None, allow_disk_use=None)
39+
.. automethod:: find_one(filter=None, *args, **kwargs)
40+
.. automethod:: find_one_and_delete
41+
.. automethod:: find_one_and_replace(filter, replacement, projection=None, sort=None, return_document=ReturnDocument.BEFORE, hint=None, session=None, **kwargs)
42+
.. automethod:: find_one_and_update(filter, update, projection=None, sort=None, return_document=ReturnDocument.BEFORE, array_filters=None, hint=None, session=None, **kwargs)
43+
.. automethod:: count_documents
44+
.. automethod:: estimated_document_count
45+
.. automethod:: distinct
46+
.. automethod:: create_index
47+
.. automethod:: create_indexes
48+
.. automethod:: drop_index
49+
.. automethod:: drop_indexes
50+
.. automethod:: list_indexes
51+
.. automethod:: index_information
52+
.. automethod:: create_search_index
53+
.. automethod:: create_search_indexes
54+
.. automethod:: drop_search_index
55+
.. automethod:: list_search_indexes
56+
.. automethod:: update_search_index
57+
.. automethod:: drop
58+
.. automethod:: rename
59+
.. automethod:: options
60+
.. automethod:: __getitem__
61+
.. automethod:: __getattr__
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:mod:`command_cursor` -- Tools for iterating over MongoDB command results
2+
=========================================================================
3+
4+
.. automodule:: pymongo.asynchronous.command_cursor
5+
:synopsis: Tools for iterating over MongoDB command results
6+
:members:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
:mod:`cursor` -- Tools for iterating over MongoDB query results
2+
===============================================================
3+
4+
.. automodule:: pymongo.asynchronous.cursor
5+
:synopsis: Tools for iterating over MongoDB query results
6+
7+
.. autoclass:: pymongo.asynchronous.cursor.AsyncCursor(collection, filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, batch_size=0, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, session=None, allow_disk_use=None)
8+
:members:
9+
10+
.. describe:: c[index]
11+
12+
See :meth:`__getitem__` and read the warning.
13+
14+
.. automethod:: __getitem__
15+
16+
.. autoclass:: pymongo.asynchronous.cursor.AsyncRawBatchCursor(collection, filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, batch_size=0, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, allow_disk_use=None)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
:mod:`database` -- Database level operations
2+
============================================
3+
4+
.. automodule:: pymongo.asynchronous.database
5+
:synopsis: Database level operations
6+
7+
.. autoclass:: pymongo.asynchronous.database.AsyncDatabase
8+
:members:
9+
10+
.. describe:: db[collection_name] || db.collection_name
11+
12+
Get the `collection_name` :class:`~pymongo.asynchronous.collection.AsyncCollection` of
13+
:class:`AsyncDatabase` `db`.
14+
15+
Raises :class:`~pymongo.errors.InvalidName` if an invalid collection
16+
name is used.
17+
18+
.. note:: Use dictionary style access if `collection_name` is an
19+
attribute of the :class:`AsyncDatabase` class eg: db[`collection_name`].
20+
21+
.. automethod:: __getitem__
22+
.. automethod:: __getattr__
23+
.. autoattribute:: codec_options
24+
.. autoattribute:: read_preference
25+
.. autoattribute:: write_concern
26+
.. autoattribute:: read_concern
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
:mod:`pymongo async` -- Async Python driver for MongoDB
2+
=======================================================
3+
4+
.. automodule:: pymongo.asynchronous
5+
:synopsis: Asynchronous Python driver for MongoDB
6+
7+
.. data:: AsyncMongoClient
8+
9+
Alias for :class:`pymongo.asynchronous.mongo_client.MongoClient`.
10+
11+
Sub-modules:
12+
13+
.. toctree::
14+
:maxdepth: 2
15+
16+
change_stream
17+
client_session
18+
collection
19+
command_cursor
20+
cursor
21+
database
22+
mongo_client
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
:mod:`mongo_client` -- Tools for connecting to MongoDB
2+
======================================================
3+
4+
.. automodule:: pymongo.asynchronous.mongo_client
5+
:synopsis: Tools for connecting to MongoDB
6+
7+
.. autoclass:: pymongo.asynchronous.mongo_client.AsyncMongoClient(host='localhost', port=27017, document_class=dict, tz_aware=False, connect=True, **kwargs)
8+
9+
.. automethod:: aclose
10+
11+
.. describe:: c[db_name] || c.db_name
12+
13+
Get the `db_name` :class:`~pymongo.asynchronous.database.AsyncDatabase` on :class:`AsyncMongoClient` `c`.
14+
15+
Raises :class:`~pymongo.errors.InvalidName` if an invalid database name is used.
16+
17+
.. autoattribute:: topology_description
18+
.. autoattribute:: address
19+
.. autoattribute:: primary
20+
.. autoattribute:: secondaries
21+
.. autoattribute:: arbiters
22+
.. autoattribute:: is_primary
23+
.. autoattribute:: is_mongos
24+
.. autoattribute:: nodes
25+
.. autoattribute:: codec_options
26+
.. autoattribute:: read_preference
27+
.. autoattribute:: write_concern
28+
.. autoattribute:: read_concern
29+
.. autoattribute:: options
30+
.. automethod:: start_session
31+
.. automethod:: list_databases
32+
.. automethod:: list_database_names
33+
.. automethod:: drop_database
34+
.. automethod:: get_default_database
35+
.. automethod:: get_database
36+
.. automethod:: server_info
37+
.. automethod:: watch
38+
.. automethod:: __getitem__
39+
.. automethod:: __getattr__

doc/api/pymongo/index.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
Alias for :class:`pymongo.mongo_client.MongoClient`.
1111

12+
.. data:: AsyncMongoClient
13+
14+
Alias for :class:`pymongo.asynchronous.mongo_client.AsyncMongoClient`.
15+
1216
.. data:: ReadPreference
1317

1418
Alias for :class:`pymongo.read_preferences.ReadPreference`.
@@ -27,8 +31,9 @@
2731
Sub-modules:
2832

2933
.. toctree::
30-
:maxdepth: 2
34+
:maxdepth: 3
3135

36+
asynchronous/index
3237
auth_oidc
3338
change_stream
3439
client_options

gridfs/asynchronous/grid_file.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,9 @@ async def next(self) -> AsyncGridOut:
18921892
next_file = await super().next()
18931893
return AsyncGridOut(self._root_collection, file_document=next_file, session=self.session)
18941894

1895+
async def to_list(self) -> list[AsyncGridOut]:
1896+
return [x async for x in self] # noqa: C416,RUF100
1897+
18951898
__anext__ = next
18961899

18971900
def add_option(self, *args: Any, **kwargs: Any) -> NoReturn:

0 commit comments

Comments
 (0)