Motor asyncio API¶
Warning
As of May 14th, 2025, Motor is deprecated in favor of the GA release of the PyMongo Async API. No new features will be added to Motor, and only bug fixes will be provided until it reaches end of life on May 14th, 2026. After that, only critical bug fixes will be made until final support ends on May 14th, 2027. We strongly recommend migrating to the PyMongo Async API while Motor is still supported. For help transitioning, see the Migrate to PyMongo Async guide.
AsyncIOMotorClient– Connection to MongoDBAsyncIOMotorClientAsyncIOMotorClient.bulk_write()AsyncIOMotorClient.drop_database()AsyncIOMotorClient.get_database()AsyncIOMotorClient.get_default_database()AsyncIOMotorClient.list_database_names()AsyncIOMotorClient.list_databases()AsyncIOMotorClient.server_info()AsyncIOMotorClient.start_session()AsyncIOMotorClient.watch()AsyncIOMotorClient.HOSTAsyncIOMotorClient.PORTAsyncIOMotorClient.addressAsyncIOMotorClient.arbitersAsyncIOMotorClient.closeAsyncIOMotorClient.codec_optionsAsyncIOMotorClient.is_mongosAsyncIOMotorClient.is_primaryAsyncIOMotorClient.nodesAsyncIOMotorClient.optionsAsyncIOMotorClient.primaryAsyncIOMotorClient.read_concernAsyncIOMotorClient.read_preferenceAsyncIOMotorClient.secondariesAsyncIOMotorClient.topology_descriptionAsyncIOMotorClient.write_concern
AsyncIOMotorClientSession– Sequence of operationsAsyncIOMotorClientSessionAsyncIOMotorClientSession.abort_transaction()AsyncIOMotorClientSession.commit_transaction()AsyncIOMotorClientSession.end_session()AsyncIOMotorClientSession.start_transaction()AsyncIOMotorClientSession.with_transaction()AsyncIOMotorClientSession.advance_cluster_timeAsyncIOMotorClientSession.advance_operation_timeAsyncIOMotorClientSession.clientAsyncIOMotorClientSession.cluster_timeAsyncIOMotorClientSession.has_endedAsyncIOMotorClientSession.in_transactionAsyncIOMotorClientSession.operation_timeAsyncIOMotorClientSession.optionsAsyncIOMotorClientSession.session_id
AsyncIOMotorDatabaseAsyncIOMotorDatabaseAsyncIOMotorDatabase.aggregate()AsyncIOMotorDatabase.command()AsyncIOMotorDatabase.create_collection()AsyncIOMotorDatabase.cursor_command()AsyncIOMotorDatabase.dereference()AsyncIOMotorDatabase.drop_collection()AsyncIOMotorDatabase.get_collection()AsyncIOMotorDatabase.list_collection_names()AsyncIOMotorDatabase.list_collections()AsyncIOMotorDatabase.validate_collection()AsyncIOMotorDatabase.watch()AsyncIOMotorDatabase.with_options()AsyncIOMotorDatabase.clientAsyncIOMotorDatabase.codec_optionsAsyncIOMotorDatabase.nameAsyncIOMotorDatabase.read_concernAsyncIOMotorDatabase.read_preferenceAsyncIOMotorDatabase.write_concern
AsyncIOMotorCollectionAsyncIOMotorCollectionAsyncIOMotorCollection.databaseAsyncIOMotorCollection.aggregate()AsyncIOMotorCollection.aggregate_raw_batches()AsyncIOMotorCollection.bulk_write()AsyncIOMotorCollection.count_documents()AsyncIOMotorCollection.create_index()AsyncIOMotorCollection.create_indexes()AsyncIOMotorCollection.create_search_index()AsyncIOMotorCollection.create_search_indexes()AsyncIOMotorCollection.delete_many()AsyncIOMotorCollection.delete_one()AsyncIOMotorCollection.distinct()AsyncIOMotorCollection.drop()AsyncIOMotorCollection.drop_index()AsyncIOMotorCollection.drop_indexes()AsyncIOMotorCollection.drop_search_index()AsyncIOMotorCollection.estimated_document_count()AsyncIOMotorCollection.find()AsyncIOMotorCollection.find_one()AsyncIOMotorCollection.find_one_and_delete()AsyncIOMotorCollection.find_one_and_replace()AsyncIOMotorCollection.find_one_and_update()AsyncIOMotorCollection.find_raw_batches()AsyncIOMotorCollection.index_information()AsyncIOMotorCollection.insert_many()AsyncIOMotorCollection.insert_one()AsyncIOMotorCollection.list_indexes()AsyncIOMotorCollection.list_search_indexes()AsyncIOMotorCollection.options()AsyncIOMotorCollection.rename()AsyncIOMotorCollection.replace_one()AsyncIOMotorCollection.update_many()AsyncIOMotorCollection.update_one()AsyncIOMotorCollection.update_search_index()AsyncIOMotorCollection.watch()AsyncIOMotorCollection.with_options()AsyncIOMotorCollection.codec_optionsAsyncIOMotorCollection.full_nameAsyncIOMotorCollection.nameAsyncIOMotorCollection.read_concernAsyncIOMotorCollection.read_preferenceAsyncIOMotorCollection.write_concern
AsyncIOMotorChangeStreamAsyncIOMotorClientEncryptionAsyncIOMotorClientEncryptionAsyncIOMotorClientEncryption.add_key_alt_name()AsyncIOMotorClientEncryption.close()AsyncIOMotorClientEncryption.create_data_key()AsyncIOMotorClientEncryption.create_encrypted_collection()AsyncIOMotorClientEncryption.decrypt()AsyncIOMotorClientEncryption.delete_key()AsyncIOMotorClientEncryption.encrypt()AsyncIOMotorClientEncryption.encrypt_expression()AsyncIOMotorClientEncryption.get_key()AsyncIOMotorClientEncryption.get_key_by_alt_name()AsyncIOMotorClientEncryption.remove_key_alt_name()AsyncIOMotorClientEncryption.rewrap_many_data_key()
AsyncIOMotorCursorAsyncIOMotorCursorAsyncIOMotorCursor.add_option()AsyncIOMotorCursor.allow_disk_use()AsyncIOMotorCursor.clone()AsyncIOMotorCursor.close()AsyncIOMotorCursor.collation()AsyncIOMotorCursor.comment()AsyncIOMotorCursor.distinct()AsyncIOMotorCursor.each()AsyncIOMotorCursor.explain()AsyncIOMotorCursor.hint()AsyncIOMotorCursor.limit()AsyncIOMotorCursor.max()AsyncIOMotorCursor.max_await_time_ms()AsyncIOMotorCursor.max_scan()AsyncIOMotorCursor.max_time_ms()AsyncIOMotorCursor.min()AsyncIOMotorCursor.next()AsyncIOMotorCursor.next_object()AsyncIOMotorCursor.remove_option()AsyncIOMotorCursor.rewind()AsyncIOMotorCursor.skip()AsyncIOMotorCursor.sort()AsyncIOMotorCursor.to_list()AsyncIOMotorCursor.where()AsyncIOMotorCursor.addressAsyncIOMotorCursor.aliveAsyncIOMotorCursor.cursor_idAsyncIOMotorCursor.fetch_nextAsyncIOMotorCursor.session
AsyncIOMotorCommandCursorAsyncIOMotorCommandCursorAsyncIOMotorCommandCursor.close()AsyncIOMotorCommandCursor.each()AsyncIOMotorCommandCursor.next()AsyncIOMotorCommandCursor.next_object()AsyncIOMotorCommandCursor.to_list()AsyncIOMotorCommandCursor.try_next()AsyncIOMotorCommandCursor.addressAsyncIOMotorCommandCursor.aliveAsyncIOMotorCommandCursor.cursor_idAsyncIOMotorCommandCursor.fetch_nextAsyncIOMotorCommandCursor.session
- asyncio GridFS Classes
AsyncIOMotorGridFSBucketAsyncIOMotorGridFSBucket.delete()AsyncIOMotorGridFSBucket.download_to_stream()AsyncIOMotorGridFSBucket.download_to_stream_by_name()AsyncIOMotorGridFSBucket.find()AsyncIOMotorGridFSBucket.open_download_stream()AsyncIOMotorGridFSBucket.open_download_stream_by_name()AsyncIOMotorGridFSBucket.open_upload_stream()AsyncIOMotorGridFSBucket.open_upload_stream_with_id()AsyncIOMotorGridFSBucket.rename()AsyncIOMotorGridFSBucket.upload_from_stream()AsyncIOMotorGridFSBucket.upload_from_stream_with_id()
AsyncIOMotorGridInAsyncIOMotorGridIn.abort()AsyncIOMotorGridIn.close()AsyncIOMotorGridIn.set()AsyncIOMotorGridIn.write()AsyncIOMotorGridIn.writelines()AsyncIOMotorGridIn.chunk_sizeAsyncIOMotorGridIn.closedAsyncIOMotorGridIn.content_typeAsyncIOMotorGridIn.filenameAsyncIOMotorGridIn.lengthAsyncIOMotorGridIn.nameAsyncIOMotorGridIn.readAsyncIOMotorGridIn.readableAsyncIOMotorGridIn.seekableAsyncIOMotorGridIn.upload_dateAsyncIOMotorGridIn.writeable
AsyncIOMotorGridOutAsyncIOMotorGridOut.open()AsyncIOMotorGridOut.read()AsyncIOMotorGridOut.readchunk()AsyncIOMotorGridOut.readline()AsyncIOMotorGridOut.stream_to_handler()AsyncIOMotorGridOut.aliasesAsyncIOMotorGridOut.chunk_sizeAsyncIOMotorGridOut.closeAsyncIOMotorGridOut.content_typeAsyncIOMotorGridOut.filenameAsyncIOMotorGridOut.lengthAsyncIOMotorGridOut.metadataAsyncIOMotorGridOut.nameAsyncIOMotorGridOut.readableAsyncIOMotorGridOut.seekAsyncIOMotorGridOut.seekableAsyncIOMotorGridOut.tellAsyncIOMotorGridOut.upload_dateAsyncIOMotorGridOut.write
AsyncIOMotorGridOutCursorAsyncIOMotorGridOutCursor.allow_disk_use()AsyncIOMotorGridOutCursor.clone()AsyncIOMotorGridOutCursor.close()AsyncIOMotorGridOutCursor.collation()AsyncIOMotorGridOutCursor.comment()AsyncIOMotorGridOutCursor.distinct()AsyncIOMotorGridOutCursor.each()AsyncIOMotorGridOutCursor.explain()AsyncIOMotorGridOutCursor.hint()AsyncIOMotorGridOutCursor.limit()AsyncIOMotorGridOutCursor.max()AsyncIOMotorGridOutCursor.max_await_time_ms()AsyncIOMotorGridOutCursor.max_scan()AsyncIOMotorGridOutCursor.max_time_ms()AsyncIOMotorGridOutCursor.min()AsyncIOMotorGridOutCursor.next()AsyncIOMotorGridOutCursor.next_object()AsyncIOMotorGridOutCursor.rewind()AsyncIOMotorGridOutCursor.skip()AsyncIOMotorGridOutCursor.sort()AsyncIOMotorGridOutCursor.to_list()AsyncIOMotorGridOutCursor.where()AsyncIOMotorGridOutCursor.addressAsyncIOMotorGridOutCursor.aliveAsyncIOMotorGridOutCursor.cursor_idAsyncIOMotorGridOutCursor.fetch_nextAsyncIOMotorGridOutCursor.session
motor.aiohttp- Integrate Motor with the aiohttp web framework
See also
This page describes using Motor with asyncio. For Tornado integration, see Motor Tornado API.