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

Method _create

pymongo/synchronous/collection.py:672–695  ·  view source on GitHub ↗
(
        self,
        options: MutableMapping[str, Any],
        session: Optional[ClientSession],
    )

Source from the content-addressed store, hash-verified

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