
    _i                       d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZmZmZ ddlmZmZmZ ddl m!Z! erddlm"Z"m#Z# ee
ee$ee$ee%e$ee$ef         f         f         f                  ee$ef         f         Z&ee$e&f         Z' G d de$ej(                  Z) G d dee                   Z* G d d          Z+ G d de+          Z, G d de+          Z- G d dee                   Z. G d d          Z/ G d de/          Z0 G d de/          Z1 G d  d!          Z2 G d" d#          Z3dS )$z~Operation class definitions.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
    )annotationsN)TYPE_CHECKINGAnyGenericMappingOptionalSequenceTupleUnion)RawBSONDocument)helpers_shared)validate_collation_or_none)validate_is_mappingvalidate_list)InvalidOperation)_gen_index_name_index_document_index_list)_CollationIn_DocumentType	_Pipeline)validate_boolean)_AgnosticBulk_AgnosticClientBulkc                      e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdS )_OpabortTransaction	aggregate	bulkWritecommitTransactioncountcreatecreateIndexescreateSearchIndexesdeletedistinctdropdropDatabasedropIndexesdropSearchIndexesendSessionsfindAndModifyfindinsertlistCollectionslistIndexeslistSearchIndexeslistDatabasesupdateupdateIndexupdateSearchIndexrenamegetMorekillCursorstestOperationN) __name__
__module____qualname__ABORT	AGGREGATE
BULK_WRITECOMMITCOUNTCREATECREATE_INDEXESCREATE_SEARCH_INDEXESDELETEDISTINCTDROPDROP_DATABASEDROP_INDEXESDROP_SEARCH_INDEXESEND_SESSIONSFIND_AND_MODIFYFINDINSERTLIST_COLLECTIONSLIST_INDEXESLIST_SEARCH_INDEXLIST_DATABASESUPDATEUPDATE_INDEXUPDATE_SEARCH_INDEXRENAMEGETMOREKILL_CURSORSTEST     5D:\Nbitz\venv\Lib\site-packages\pymongo/operations.pyr   r   5   s        EIJ FEF$N1FHD"M L- L%ODF( L+$NF L-FG LDDDr[   r   c                  H    e Zd ZdZdZddd
ZddZddZddZddZ	ddZ
dS )	InsertOnez#Represents an insert_one operation._doc
_namespaceNdocumentr   	namespaceOptional[str]returnNonec                "    || _         || _        dS )av  Create an InsertOne instance.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.bulk_write`, :meth:`~pymongo.collection.Collection.bulk_write`,
        :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write` and :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

        :param document: The document to insert. If the document is missing an
            _id field one will be added.
        :param namespace: (optional) The namespace in which to insert a document.

        .. versionchanged:: 4.9
           Added the `namespace` option to support `MongoClient.bulk_write`.
        Nr_   )selfrb   rc   s      r\   __init__zInsertOne.__init__]   s     	#r[   bulkobjr   c                :    |                     | j                   dS )>Add this operation to the _AsyncBulk/_Bulk instance `bulkobj`.N)
add_insertr`   rh   rj   s     r\   _add_to_bulkzInsertOne._add_to_bulkm   s    49%%%%%r[   r   c                r    | j         st          d          |                    | j         | j                   dS )JAdd this operation to the _AsyncClientBulk/_ClientBulk instance `bulkobj`.SMongoClient.bulk_write requires a namespace to be provided for each write operationN)ra   r   rm   r`   rn   s     r\   _add_to_client_bulkzInsertOne._add_to_client_bulkq   sO     	"e   	OI	
 	
 	
 	
 	
r[   strc                |    | j         r| j        j         d| j        d| j         dS | j        j         d| j        dS )N(, ))ra   	__class__r:   r`   rh   s    r\   __repr__zInsertOne.__repr__|   sS    ? 	Tn-SS	SStSSSS.)::DI::::r[   otherr   boolc                    t          |          t          |           k    r |j        | j        k    o|j        | j        k    S t          S N)typer`   ra   NotImplementedrh   r|   s     r\   __eq__zInsertOne.__eq__   s=    ;;$t**$$:*Ru/?4?/RRr[   c                    | |k     S r   rZ   r   s     r\   __ne__zInsertOne.__ne__       5=  r[   r   )rb   r   rc   rd   re   rf   rj   r   re   rf   rj   r   re   rf   re   rt   r|   r   re   r}   )r:   r;   r<   __doc__	__slots__ri   ro   rs   r{   r   r   rZ   r[   r\   r^   r^   U   s        --I
$ $ $ $ $ & & & &	
 	
 	
 	
; ; ; ;
   
! ! ! ! ! !r[   r^   c                  >    e Zd ZdZdZ	 	 	 dddZddZddZddZdS )	_DeleteOpz)Private base class for delete operations.)_filter
_collation_hintra   NfilterMapping[str, Any]	collationOptional[_CollationIn]hintOptional[_IndexKeyHint]rc   rd   re   rf   c                    |t          d|           |/t          |t                    st          j        |          | _        n|| _        || _        || _        || _        d S )Nr   )	r   
isinstancert   r   r   r   r   r   ra   )rh   r   r   r   rc   s        r\   ri   z_DeleteOp.__init__   sd     &111JtS$9$9;I;YZ^;_;_DJJDJ##r[   r|   r   r}   c                    t          |          t          |           k    r6|j        |j        |j        |j        f| j        | j        | j        | j        fk    S t
          S r   )r   r   r   r   ra   r   r   s     r\   r   z_DeleteOp.__eq__   sa    ;;$t**$$  	 
	
 
 r[   c                    | |k     S r   rZ   r   s     r\   r   z_DeleteOp.__ne__   r   r[   rt   c                    | j         r7d                    | j        j        | j        | j        | j        | j                   S | j        j         d| j        d| j        d| j        dS )Nz{}({!r}, {!r}, {!r}, {!r})rv   rw   rx   )ra   formatry   r:   r   r   r   rz   s    r\   r{   z_DeleteOp.__repr__   sv    ? 	/66'
   .)bbDLbbdobbSWS]bbbbr[   NNN
r   r   r   r   r   r   rc   rd   re   rf   r   r   	r:   r;   r<   r   r   ri   r   r   r{   rZ   r[   r\   r   r      s        33I -1(,#'$ $ $ $ $$   ! ! ! !	c 	c 	c 	c 	c 	cr[   r   c                  @     e Zd ZdZdZ	 	 	 dd fdZddZddZ xZS )	DeleteOnez"Represents a delete_one operation.rZ   Nr   r   r   r   r   r   rc   rd   re   rf   c                P    t                                          ||||           dS )a  Create a DeleteOne instance.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.bulk_write`, :meth:`~pymongo.collection.Collection.bulk_write`,
        :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write` and :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

        :param filter: A query that matches the document to delete.
        :param collation: An instance of
            :class:`~pymongo.collation.Collation`.
        :param hint: An index to use to support the query
            predicate specified either by its string name, or in the same
            format as passed to
            :meth:`~pymongo.asynchronous.collection.AsyncCollection.create_index` or :meth:`~pymongo.collection.Collection.create_index` (e.g.
            ``[('field', ASCENDING)]``). This option is only supported on
            MongoDB 4.4 and above.
        :param namespace: (optional) The namespace in which to delete a document.

        .. versionchanged:: 4.9
           Added the `namespace` option to support `MongoClient.bulk_write`.
        .. versionchanged:: 3.11
           Added the ``hint`` option.
        .. versionchanged:: 3.5
           Added the `collation` option.
        Nsuperri   rh   r   r   r   rc   ry   s        r\   ri   zDeleteOne.__init__   )    < 	D)<<<<<r[   rj   r   c                p    |                     | j        dt          | j                  | j                   dS )rl      r   r   N
add_deleter   r   r   r   rn   s     r\   ro   zDeleteOne._add_to_bulk   C    L0AA	 	 	
 	
 	
 	
 	
r[   r   c                    | j         st          d          |                    | j         | j        dt	          | j                  | j                   dS )rq   rr   Fmultir   r   Nra   r   r   r   r   r   r   rn   s     r\   rs   zDeleteOne._add_to_client_bulk   si     	"e   	OL0AA 	 	
 	
 	
 	
 	
r[   r   r   r   r   	r:   r;   r<   r   r   ri   ro   rs   __classcell__ry   s   @r\   r   r      s        ,,I
 -1(,#'= = = = = = =@
 
 
 

 
 
 
 
 
 
 
r[   r   c                  @     e Zd ZdZdZ	 	 	 dd fdZddZddZ xZS )
DeleteManyz#Represents a delete_many operation.rZ   Nr   r   r   r   r   r   rc   rd   re   rf   c                P    t                                          ||||           dS )a  Create a DeleteMany instance.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.bulk_write`, :meth:`~pymongo.collection.Collection.bulk_write`,
        :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write` and :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

        :param filter: A query that matches the documents to delete.
        :param collation: An instance of
            :class:`~pymongo.collation.Collation`.
        :param hint: An index to use to support the query
            predicate specified either by its string name, or in the same
            format as passed to
            :meth:`~pymongo.asynchronous.collection.AsyncCollection.create_index` or :meth:`~pymongo.collection.Collection.create_index` (e.g.
            ``[('field', ASCENDING)]``). This option is only supported on
            MongoDB 4.4 and above.
        :param namespace: (optional) The namespace in which to delete documents.

        .. versionchanged:: 4.9
           Added the `namespace` option to support `MongoClient.bulk_write`.
        .. versionchanged:: 3.11
           Added the ``hint`` option.
        .. versionchanged:: 3.5
           Added the `collation` option.
        Nr   r   s        r\   ri   zDeleteMany.__init__  r   r[   rj   r   c                p    |                     | j        dt          | j                  | j                   dS )rl   r   r   Nr   rn   s     r\   ro   zDeleteMany._add_to_bulk&  r   r[   r   c                    | j         st          d          |                    | j         | j        dt	          | j                  | j                   dS )rq   rr   Tr   Nr   rn   s     r\   rs   zDeleteMany._add_to_client_bulk/  si     	"e   	OL0AA 	 	
 	
 	
 	
 	
r[   r   r   r   r   r   r   s   @r\   r   r     s        --I
 -1(,#'= = = = = = =@
 
 
 

 
 
 
 
 
 
 
r[   r   c                  R    e Zd ZdZdZ	 	 	 	 	 d!d"dZd#dZd$dZd%dZd%dZ	d&d Z
dS )'
ReplaceOnez#Represents a replace_one operation.)r   r`   _upsertr   r   ra   _sortNr   r   replacement%Union[_DocumentType, RawBSONDocument]upsertOptional[bool]r   r   r   r   rc   rd   sortOptional[Mapping[str, Any]]re   rf   c                   |t          d|           |t          d|           |/t          |t                    st	          j        |          | _        n|| _        || _        || _        || _	        || _
        || _        || _        dS )a]  Create a ReplaceOne instance.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.bulk_write`, :meth:`~pymongo.collection.Collection.bulk_write`,
        :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write` and :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

        :param filter: A query that matches the document to replace.
        :param replacement: The new document.
        :param upsert: If ``True``, perform an insert if no documents
            match the filter.
        :param collation: An instance of
            :class:`~pymongo.collation.Collation`.
        :param hint: An index to use to support the query
            predicate specified either by its string name, or in the same
            format as passed to
            :meth:`~pymongo.asynchronous.collection.AsyncCollection.create_index` or :meth:`~pymongo.collection.Collection.create_index` (e.g.
            ``[('field', ASCENDING)]``). This option is only supported on
            MongoDB 4.2 and above.
        :param sort: Specify which document the operation updates if the query matches
            multiple documents. The first document matched by the sort order will be updated.
        :param namespace: (optional) The namespace in which to replace a document.

        .. versionchanged:: 4.10
            Added ``sort`` option.
        .. versionchanged:: 4.9
           Added the `namespace` option to support `MongoClient.bulk_write`.
        .. versionchanged:: 3.11
           Added the ``hint`` option.
        .. versionchanged:: 3.5
           Added the ``collation`` option.
        Nr   r   )r   r   r   rt   r   r   r   r   r   r`   r   r   ra   )rh   r   r   r   r   r   rc   r   s           r\   ri   zReplaceOne.__init__K  s    P &111Xv...JtS$9$9;I;YZ^;_;_DJJDJ
	##r[   rj   r   c                    |                     | j        | j        | j        t	          | j                  | j        | j                   dS )rl   r   r   r   N)add_replacer   r`   r   r   r   r   r   rn   s     r\   ro   zReplaceOne._add_to_bulk  sO    LIL0AA 	 	
 	
 	
 	
 	
r[   r   c           	         | j         st          d          |                    | j         | j        | j        | j        t          | j                  | j        | j	                   dS )rq   rr   r   N)
ra   r   r   r   r`   r   r   r   r   r   rn   s     r\   rs   zReplaceOne._add_to_client_bulk  su     	"e   	OLIL0AA 	 	
 	
 	
 	
 	
r[   r|   r   r}   c                   t          |          t          |           k    rZ|j        |j        |j        |j        |j        |j        |j        f| j        | j        | j        | j        | j        | j        | j        fk    S t          S r   )	r   r   r`   r   r   r   ra   r   r   r   s     r\   r   zReplaceOne.__eq__  s    ;;$t**$$
   	

 " r[   c                    | |k     S r   rZ   r   s     r\   r   zReplaceOne.__ne__  r   r[   rt   c           
     (   | j         rId                    | j        j        | j        | j        | j        | j        | j        | j         | j	                  S d                    | j        j        | j        | j        | j        | j        | j        | j	                  S )N,{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})z&{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r}))
ra   r   ry   r:   r   r`   r   r   r   r   rz   s    r\   r{   zReplaceOne.__repr__  s    ? 
	AHH'	

	 	 	 8>>N#LILOJJ
 
 	
r[   NNNNN)r   r   r   r   r   r   r   r   r   r   rc   rd   r   r   re   rf   r   r   r   r   )r:   r;   r<   r   r   ri   ro   rs   r   r   r{   rZ   r[   r\   r   r   >  s        --I "&,0(,#',06$ 6$ 6$ 6$ 6$p	
 	
 	
 	

 
 
 
    *! ! ! !
 
 
 
 
 
r[   r   c                  6    e Zd ZdZdZddZddZd dZd!dZdS )"	_UpdateOpz)Private base class for update operations.)r   r`   r   r   _array_filtersr   ra   r   r   r   doc#Union[Mapping[str, Any], _Pipeline]r   r   r   r   array_filters!Optional[list[Mapping[str, Any]]]r   r   rc   rd   r   r   c	                D   |t          d|           |t          d|           |t          d|           |/t          |t                    st          j        |          | _        n|| _        || _        || _	        || _
        || _        || _        || _        || _        d S )Nr   r   r   )r   r   r   r   rt   r   r   r   r   r`   r   r   r   ra   r   )	rh   r   r   r   r   r   r   rc   r   s	            r\   ri   z_UpdateOp.__init__  s     &111Xv...$/=999JtS$9$9;I;YZ^;_;_DJJDJ	#+#


r[   r|   objectre   r}   c           	        t          |t          |                     rf|j        |j        |j        |j        |j        |j        |j        |j	        f| j        | j        | j        | j        | j        | j        | j        | j	        fk    S t          S r   )r   r   r   r`   r   r   r   r   ra   r   r   r   s     r\   r   z_UpdateOp.__eq__  s    eT$ZZ(( 	
 $ 	 	#

	 & r[   r   c                    | |k     S r   rZ   r   s     r\   r   z_UpdateOp.__ne__  r   r[   rt   c                @   | j         rOd                    | j        j        | j        | j        | j        | j        | j        | j	        | j         | j
        	  	        S d                    | j        j        | j        | j        | j        | j        | j        | j	        | j
                  S )Nz2{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})r   )ra   r   ry   r:   r   r`   r   r   r   r   r   rz   s    r\   r{   z_UpdateOp.__repr__  s    ? 	GNN'	#


 
 
 >DDN#LILOJJ	
 	
 		
r[   N)r   r   r   r   r   r   r   r   r   r   r   r   rc   rd   r   r   )r|   r   re   r}   r   r   r   rZ   r[   r\   r   r     sq        33	I   :   .! ! ! !
 
 
 
 
 
r[   r   c                  F     e Zd ZdZdZ	 	 	 	 	 	 dd fdZddZddZ xZS ) 	UpdateOnez#Represents an update_one operation.rZ   Nr   r   r3   r   r   r   r   r   r   r   r   r   rc   rd   r   r   re   rf   c	           
     X    t                                          ||||||||           dS )a{  Represents an update_one operation.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.bulk_write`, :meth:`~pymongo.collection.Collection.bulk_write`,
        :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write` and :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

        :param filter: A query that matches the document to update.
        :param update: The modifications to apply.
        :param upsert: If ``True``, perform an insert if no documents
            match the filter.
        :param collation: An instance of
            :class:`~pymongo.collation.Collation`.
        :param array_filters: A list of filters specifying which
            array elements an update should apply.
        :param hint: An index to use to support the query
            predicate specified either by its string name, or in the same
            format as passed to
            :meth:`~pymongo.asynchronous.collection.AsyncCollection.create_index` or :meth:`~pymongo.collection.Collection.create_index` (e.g.
            ``[('field', ASCENDING)]``). This option is only supported on
            MongoDB 4.2 and above.
        :param namespace: The namespace in which to update a document.
        :param sort: Specify which document the operation updates if the query matches
            multiple documents. The first document matched by the sort order will be updated.

        .. versionchanged:: 4.10
            Added ``sort`` option.
        .. versionchanged:: 4.9
           Added the `namespace` option to support `MongoClient.bulk_write`.
        .. versionchanged:: 3.11
           Added the `hint` option.
        .. versionchanged:: 3.9
           Added the ability to accept a pipeline as the `update`.
        .. versionchanged:: 3.6
           Added the `array_filters` option.
        .. versionchanged:: 3.5
           Added the `collation` option.
        Nr   )
rh   r   r3   r   r   r   r   rc   r   ry   s
            r\   ri   zUpdateOne.__init__0  s4    ^ 	M4QZ\`aaaaar[   rj   r   c           
         |                     | j        | j        dt          | j                  t          | j                  | j        | j        | j	                   dS )rl   Fr   r   r   r   N)

add_updater   r`   r}   r   r   r   r   r   r   rn   s     r\   ro   zUpdateOne._add_to_bulka  s`    LI0AA- 	 		
 		
 		
 		
 		
r[   r   c                    | j         st          d          |                    | j         | j        | j        d| j        t          | j                  | j        | j	        | j
        	  	         dS )rq   rr   Fr   N)ra   r   r   r   r`   r   r   r   r   r   r   rn   s     r\   rs   zUpdateOne._add_to_client_bulkn  s~     	"e   	OLIL0AA- 	 
	
 
	
 
	
 
	
 
	
r[   )NNNNNN)r   r   r3   r   r   r   r   r   r   r   r   r   rc   rd   r   r   re   rf   r   r   r   r   s   @r\   r   r   +  s        --I "&,0;?(,#',0/b /b /b /b /b /b /bb
 
 
 

 
 
 
 
 
 
 
r[   r   c                  D     e Zd ZdZdZ	 	 	 	 	 dd fdZddZddZ xZS )
UpdateManyz$Represents an update_many operation.rZ   Nr   r   r3   r   r   r   r   r   r   r   r   r   rc   rd   re   rf   c           
     X    t                                          |||||||d           dS )a  Create an UpdateMany instance.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.bulk_write`, :meth:`~pymongo.collection.Collection.bulk_write`,
        :meth:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write` and :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

        :param filter: A query that matches the documents to update.
        :param update: The modifications to apply.
        :param upsert: If ``True``, perform an insert if no documents
            match the filter.
        :param collation: An instance of
            :class:`~pymongo.collation.Collation`.
        :param array_filters: A list of filters specifying which
            array elements an update should apply.
        :param hint: An index to use to support the query
            predicate specified either by its string name, or in the same
            format as passed to
            :meth:`~pymongo.asynchronous.collection.AsyncCollection.create_index` or :meth:`~pymongo.collection.Collection.create_index` (e.g.
            ``[('field', ASCENDING)]``). This option is only supported on
            MongoDB 4.2 and above.
        :param namespace: (optional) The namespace in which to update documents.

        .. versionchanged:: 4.9
           Added the `namespace` option to support `MongoClient.bulk_write`.
        .. versionchanged:: 3.11
           Added the `hint` option.
        .. versionchanged:: 3.9
           Added the ability to accept a pipeline as the `update`.
        .. versionchanged:: 3.6
           Added the `array_filters` option.
        .. versionchanged:: 3.5
           Added the `collation` option.
        Nr   )	rh   r   r3   r   r   r   r   rc   ry   s	           r\   ri   zUpdateMany.__init__  s4    T 	M4QZ\`aaaaar[   rj   r   c           	         |                     | j        | j        d| j        t	          | j                  | j        | j                   dS )rl   Tr   r   r   N)r   r   r`   r   r   r   r   r   rn   s     r\   ro   zUpdateMany._add_to_bulk  sS    LIL0AA- 	 	
 	
 	
 	
 	
r[   r   c           
         | j         st          d          |                    | j         | j        | j        d| j        t          | j                  | j        | j	                   dS )rq   rr   Tr   N)
ra   r   r   r   r`   r   r   r   r   r   rn   s     r\   rs   zUpdateMany._add_to_client_bulk  sy     	"e   	OLIL0AA- 	 		
 		
 		
 		
 		
r[   r   )r   r   r3   r   r   r   r   r   r   r   r   r   rc   rd   re   rf   r   r   r   r   s   @r\   r   r     s        ..I "&,0;?(,#'*b *b *b *b *b *b *bX

 

 

 


 
 
 
 
 
 
 
r[   r   c                  >    e Zd ZdZdZdd	Zedd            ZddZdS )
IndexModelzRepresents an index to create.
__documentkeys_IndexKeyHintkwargsr   re   rf   c                   t          |          }|                    d          t          |          |d<   t          |          |d<   t	          |                    dd                    }|| _        ||| j        d<   dS dS )a  Create an Index instance.

        For use with :meth:`~pymongo.asynchronous.collection.AsyncCollection.create_indexes` and :meth:`~pymongo.collection.Collection.create_indexes`.

        Takes either a single key or a list containing (key, direction) pairs
        or keys.  If no direction is given, :data:`~pymongo.ASCENDING` will
        be assumed.
        The key(s) must be an instance of :class:`str`, and the direction(s) must
        be one of (:data:`~pymongo.ASCENDING`, :data:`~pymongo.DESCENDING`,
        :data:`~pymongo.GEO2D`, :data:`~pymongo.GEOSPHERE`,
        :data:`~pymongo.HASHED`, :data:`~pymongo.TEXT`).

        Valid options include, but are not limited to:

          - `name`: custom name to use for this index - if none is
            given, a name will be generated.
          - `unique`: if ``True``, creates a uniqueness constraint on the index.
          - `background`: if ``True``, this index should be created in the
            background.
          - `sparse`: if ``True``, omit from the index any documents that lack
            the indexed field.
          - `bucketSize`: for use with geoHaystack indexes.
            Number of documents to group together within a certain proximity
            to a given longitude and latitude.
          - `min`: minimum value for keys in a :data:`~pymongo.GEO2D`
            index.
          - `max`: maximum value for keys in a :data:`~pymongo.GEO2D`
            index.
          - `expireAfterSeconds`: <int> Used to create an expiring (TTL)
            collection. MongoDB will automatically delete documents from
            this collection after <int> seconds. The indexed field must
            be a UTC datetime or the data will not expire.
          - `partialFilterExpression`: A document that specifies a filter for
            a partial index.
          - `collation`: An instance of :class:`~pymongo.collation.Collation`
            that specifies the collation to use.
          - `wildcardProjection`: Allows users to include or exclude specific
            field paths from a `wildcard index`_ using the { "$**" : 1} key
            pattern. Requires MongoDB >= 4.2.
          - `hidden`: if ``True``, this index will be hidden from the query
            planner and will not be evaluated as part of query plan
            selection. Requires MongoDB >= 4.4.

        See the MongoDB documentation for a full list of supported options by
        server version.

        :param keys: a single key or a list containing (key, direction) pairs
             or keys specifying the index to create.
        :param kwargs: any additional index creation
            options (see the above list) should be passed as keyword
            arguments.

        .. versionchanged:: 3.11
           Added the ``hidden`` option.
        .. versionchanged:: 3.2
           Added the ``partialFilterExpression`` option to support partial
           indexes.

        .. _wildcard index: https://dochub.mongodb.org/core/index-wildcard/
        nameNkeyr   )r   getr   r   r   pop_IndexModel__document)rh   r   r   r   s       r\   ri   zIndexModel.__init__  s    z 4  ::f%,T22F6N'--u.vzz+t/L/LMM	  +4DOK((( ! r[   dict[str, Any]c                    | j         S )zUAn index document suitable for passing to the createIndexes
        command.
        )r   rz   s    r\   rb   zIndexModel.document  s    
 r[   rt   c           	         d                     | j        j        | j        d         d                    d | j                                        D                                 S )Nz{}({}{})r    c                0    g | ]\  }}|d k    d| d|S )r   rw   =rZ   .0r   values      r\   
<listcomp>z'IndexModel.__repr__.<locals>.<listcomp>&  s9    bbbjc5UX\aUaUa)#))))UaUaUar[   )r   ry   r:   rb   joinitemsrz   s    r\   r{   zIndexModel.__repr__"  sX      N#M% GGbbDM<O<O<Q<Qbbbcc
 
 	
r[   N)r   r   r   r   re   rf   )re   r   r   	r:   r;   r<   r   r   ri   propertyrb   r{   rZ   r[   r\   r   r     sl        ((ID5 D5 D5 D5L    X
 
 
 
 
 
r[   r   c                  D    e Zd ZdZdZ	 	 dddZedd            ZddZdS )SearchIndexModelz$Represents a search index to create.r   N
definitionr   r   rd   r   r   r   re   rf   c                    i | _         |
|| j         d<   || j         d<   |
|| j         d<   | j                             |           dS )a  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 present.
        :param type: The type for this index which defaults to "search". Alternative values include "vectorSearch".
        :param kwargs: Keyword arguments supplying any additional options.

        .. note:: Search indexes require a MongoDB server version 7.0+ Atlas cluster.
        .. versionadded:: 4.5
        .. versionchanged:: 4.7
           Added the type and kwargs arguments.
        Nr   r  r   )_SearchIndexModel__documentr3   )rh   r  r   r   r   s        r\   ri   zSearchIndexModel.__init__/  sW    * +-&*DOF#(2%&*DOF#v&&&&&r[   c                    | j         S )zThe document for this index.)r  rz   s    r\   rb   zSearchIndexModel.documentL  s     r[   rt   c                    d                     | j        j        d                    d | j                                        D                                 S )Nz{}({})rw   c                "    g | ]\  }}| d |S )r   rZ   r   s      r\   r   z-SearchIndexModel.__repr__.<locals>.<listcomp>T  s*    RRRjc5#))))RRRr[   )r   ry   r:   r   rb   r   rz   s    r\   r{   zSearchIndexModel.__repr__Q  sL    N#IIRRDM<O<O<Q<QRRRSS
 
 	
r[   )NN)
r  r   r   rd   r   rd   r   r   re   rf   )re   r   r   r   rZ   r[   r\   r  r  *  st        ..I
 #"	' ' ' ' ':    X
 
 
 
 
 
r[   r  )4r   
__future__r   enumtypingr   r   r   r   r   r	   r
   r   bson.raw_bsonr   pymongor   pymongo.collationr   pymongo.commonr   r   pymongo.errorsr   pymongo.helpers_sharedr   r   r   pymongo.typingsr   r   r   pymongo.write_concernr   r   r   rt   int
_IndexListr   Enumr   r^   r   r   r   r   r   r   r   r   r  rZ   r[   r\   <module>r     s    # " " " " " 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 * ) ) ) ) ) " " " " " " 8 8 8 8 8 8 = = = = = = = = + + + + + + P P P P P P P P P P B B B B B B B B B B 2 2 2 2 2 2 CBBBBBBBB U3c5c7383D)D#EEFFGH'RUWZRZJ[[
 c:o&    #ty   @2! 2! 2! 2! 2!& 2! 2! 2!j7c 7c 7c 7c 7c 7c 7c 7ct:
 :
 :
 :
 :
	 :
 :
 :
z:
 :
 :
 :
 :
 :
 :
 :
zL
 L
 L
 L
 L
' L
 L
 L
^[
 [
 [
 [
 [
 [
 [
 [
|S
 S
 S
 S
 S
	 S
 S
 S
lL
 L
 L
 L
 L
 L
 L
 L
^W
 W
 W
 W
 W
 W
 W
 W
t+
 +
 +
 +
 +
 +
 +
 +
 +
 +
r[   