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

Method _create

pymongo/asynchronous/collection.py:671–696  ·  view source on GitHub ↗
(
        self,
        options: MutableMapping[str, Any],
        session: Optional[AsyncClientSession],
    )

Source from the content-addressed store, hash-verified

669 await self.database.client._retryable_write(False, inner, session, _Op.CREATE)
670
671 async def _create(
672 self,
673 options: MutableMapping[str, Any],
674 session: Optional[AsyncClientSession],
675 ) -> None:
676 collation = validate_collation_or_none(options.pop("collation", None))
677 encrypted_fields = options.pop("encryptedFields", None)
678 if encrypted_fields:
679 common.validate_is_mapping("encrypted_fields", encrypted_fields)
680 opts = {"clusteredIndex": {"key": {"_id": 1}, "unique": True}}
681 await self._create_helper(
682 _esc_coll_name(encrypted_fields, self._name),
683 opts,
684 None,
685 session,
686 qev2_required=True,
687 )
688 await self._create_helper(
689 _ecoc_coll_name(encrypted_fields, self._name), opts, None, session
690 )
691 await self._create_helper(
692 self._name, options, collation, session, encrypted_fields=encrypted_fields
693 )
694 await self.create_index([("__safeContent__", ASCENDING)], session)
695 else:
696 await self._create_helper(self._name, options, collation, session)
697
698 @_csot.apply
699 async def bulk_write(

Callers 2

create_collectionMethod · 0.95
__init__Method · 0.95

Calls 6

_create_helperMethod · 0.95
create_indexMethod · 0.95
_esc_coll_nameFunction · 0.90
_ecoc_coll_nameFunction · 0.90
popMethod · 0.45

Tested by

no test coverage detected