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

Method __init__

pymongo/operations.py:815–842  ·  view source on GitHub ↗

Create a Search Index instance. For use with :meth:`~pymongo.collection.AsyncCollection.create_search_index` and :meth:`~pymongo.collection.AsyncCollection.create_search_indexes`. :param definition: The definition for this index. :param name: The name for this index, if pre

(
        self,
        definition: Mapping[str, Any],
        name: Optional[str] = None,
        type: Optional[str] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

813 __slots__ = ("__document",)
814
815 def __init__(
816 self,
817 definition: Mapping[str, Any],
818 name: Optional[str] = None,
819 type: Optional[str] = None,
820 **kwargs: Any,
821 ) -> None:
822 """Create a Search Index instance.
823
824 For use with :meth:`~pymongo.collection.AsyncCollection.create_search_index` and :meth:`~pymongo.collection.AsyncCollection.create_search_indexes`.
825
826 :param definition: The definition for this index.
827 :param name: The name for this index, if present.
828 :param type: The type for this index which defaults to "search". Alternative values include "vectorSearch".
829 :param kwargs: Keyword arguments supplying any additional options.
830
831 .. note:: Search indexes require a MongoDB server version 7.0+ Atlas cluster.
832 .. versionadded:: 4.5
833 .. versionchanged:: 4.7
834 Added the type and kwargs arguments.
835 """
836 self.__document: dict[str, Any] = {}
837 if name is not None:
838 self.__document["name"] = name
839 self.__document["definition"] = definition
840 if type is not None:
841 self.__document["type"] = type
842 self.__document.update(kwargs)
843
844 @property
845 def document(self) -> Mapping[str, Any]:

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected