MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / drop

Method drop

pymongo/asynchronous/collection.py:1455–1496  ·  view source on GitHub ↗

Alias for :meth:`~pymongo.asynchronous.database.AsyncDatabase.drop_collection`. :param session: a :class:`~pymongo.asynchronous.client_session.AsyncClientSession`. :param comment: A user-provided comment to attach to this command. :param encrypted_fie

(
        self,
        session: Optional[AsyncClientSession] = None,
        comment: Optional[Any] = None,
        encrypted_fields: Optional[Mapping[str, Any]] = None,
    )

Source from the content-addressed store, hash-verified

1453 )
1454
1455 async def drop(
1456 self,
1457 session: Optional[AsyncClientSession] = None,
1458 comment: Optional[Any] = None,
1459 encrypted_fields: Optional[Mapping[str, Any]] = None,
1460 ) -> None:
1461 """Alias for :meth:`~pymongo.asynchronous.database.AsyncDatabase.drop_collection`.
1462
1463 :param session: a
1464 :class:`~pymongo.asynchronous.client_session.AsyncClientSession`.
1465 :param comment: A user-provided comment to attach to this
1466 command.
1467 :param encrypted_fields: **(BETA)** Document that describes the encrypted fields for
1468 Queryable Encryption.
1469
1470 The following two calls are equivalent:
1471
1472 >>> await db.foo.drop()
1473 >>> await db.drop_collection("foo")
1474
1475 .. versionchanged:: 4.2
1476 Added ``encrypted_fields`` parameter.
1477
1478 .. versionchanged:: 4.1
1479 Added ``comment`` parameter.
1480
1481 .. versionchanged:: 3.7
1482 :meth:`drop` now respects this :class:`AsyncCollection`'s :attr:`write_concern`.
1483
1484 .. versionchanged:: 3.6
1485 Added ``session`` parameter.
1486 """
1487 dbo = self._database.client.get_database(
1488 self._database.name,
1489 self.codec_options,
1490 self.read_preference,
1491 self.write_concern,
1492 self.read_concern,
1493 )
1494 await dbo.drop_collection(
1495 self._name, session=session, comment=comment, encrypted_fields=encrypted_fields
1496 )
1497
1498 async def _delete(
1499 self,

Callers

nothing calls this directly

Calls 2

get_databaseMethod · 0.45
drop_collectionMethod · 0.45

Tested by

no test coverage detected