
    nh|                    .   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jP                        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#      Z3y)$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y)_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     x/var/www/html/SchoolMeal/SchoolMeal/pds_admin_SchoolMeal/Backend/venv/lib/python3.12/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Dr[   r   c                  F    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
y)	InsertOnez#Represents an insert_one operation._doc
_namespaceNc                     || _         || _        y)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_   )selfdocument	namespaces      r\   __init__zInsertOne.__init__]   s     	#r[   c                :    |j                  | j                         y)>Add this operation to the _AsyncBulk/_Bulk instance `bulkobj`.N)
add_insertr`   rc   bulkobjs     r\   _add_to_bulkzInsertOne._add_to_bulkm   s    499%r[   c                ~    | j                   st        d      |j                  | j                   | j                         y)JAdd this operation to the _AsyncClientBulk/_ClientBulk instance `bulkobj`.SMongoClient.bulk_write requires a namespace to be provided for each write operationN)ra   r   ri   r`   rj   s     r\   _add_to_client_bulkzInsertOne._add_to_client_bulkq   s7    "e  	OOII	
r[   c                    | j                   r3| j                  j                   d| j                  d| j                   dS | j                  j                   d| j                  dS )N(, ))ra   	__class__r:   r`   rc   s    r\   __repr__zInsertOne.__repr__|   sY    ??nn--.a		}Bt>QQRSS..))*!DII=::r[   c                    t        |      t        |       k(  r4|j                  | j                  k(  xr |j                  | j                  k(  S t        S N)typer`   ra   NotImplementedrc   others     r\   __eq__zInsertOne.__eq__   s?    ;$t*$::*Ru/?/?4??/RRr[   c                    | |k(   S ry   rZ   r|   s     r\   __ne__zInsertOne.__ne__       5=  r[   ry   )rd   r   re   Optional[str]returnNonerk   r   r   r   rk   r   r   r   r   strr}   r   r   bool)r:   r;   r<   __doc__	__slots__rf   rl   rp   rw   r~   r   rZ   r[   r\   r^   r^   U   s*    -I
$ &	
;

!r[   r^   c                  N    e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 	 	 d	dZd
dZd
dZddZy)	_DeleteOpz)Private base class for delete operations.)_filter
_collation_hintra   Nc                    |t        d|       |+t        |t              st        j                  |      | _        n|| _        || _        || _        || _        y )Nfilter)	r   
isinstancer   r   r   r   r   r   ra   )rc   r   	collationhintre   s        r\   rf   z_DeleteOp.__init__   sR     &1JtS$9;I;Y;YZ^;_DJDJ##r[   c                    t        |      t        |       k(  r]|j                  |j                  |j                  |j                  f| j                  | j                  | j                  | j                  fk(  S t
        S ry   )rz   r   r   r   ra   r{   r|   s     r\   r~   z_DeleteOp.__eq__   sl    ;$t*$    	 

	
 
 r[   c                    | |k(   S ry   rZ   r|   s     r\   r   z_DeleteOp.__ne__   r   r[   c                <   | j                   rQdj                  | j                  j                  | j                  | j
                  | j                  | j                         S | j                  j                   d| j                  d| j
                  d| j                  dS )Nz{}({!r}, {!r}, {!r}, {!r})rr   rs   rt   )ra   formatru   r:   r   r   r   rv   s    r\   rw   z_DeleteOp.__repr__   s    ??/66''

  ..))*!DLL+;2doo=PPRSWS]S]R``abbr[   NNN
r   Mapping[str, Any]r   Optional[_CollationIn]r   Optional[_IndexKeyHint]re   r   r   r   r   r   	r:   r;   r<   r   r   rf   r~   r   rw   rZ   r[   r\   r   r      s\    3I -1(,#'$!$ *$ &	$
 !$ 
$$!	cr[   r   c                  R     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   c                *    t         |   ||||       y)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superrf   rc   r   r   r   re   ru   s        r\   rf   zDeleteOne.__init__       < 	D)<r[   c                |    |j                  | j                  dt        | j                        | j                         y)rh      r   r   N
add_deleter   r   r   r   rj   s     r\   rl   zDeleteOne._add_to_bulk   2    LL0A	 	 	
r[   c                    | j                   st        d      |j                  | j                   | j                  dt	        | j
                        | j                         y)rn   ro   Fmultir   r   Nra   r   r   r   r   r   r   rj   s     r\   rp   zDeleteOne._add_to_client_bulk   sR    "e  	OOLL0A 	 	
r[   r   r   r   r   	r:   r;   r<   r   r   rf   rl   rp   __classcell__ru   s   @r\   r   r      sV    ,I
 -1(,#'=!= *= &	=
 != 
=@

r[   r   c                  R     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   c                *    t         |   ||||       y)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\   rf   zDeleteMany.__init__  r   r[   c                |    |j                  | j                  dt        | j                        | j                         y)rh   r   r   Nr   rj   s     r\   rl   zDeleteMany._add_to_bulk&  r   r[   c                    | j                   st        d      |j                  | j                   | j                  dt	        | j
                        | j                         y)rn   ro   Tr   Nr   rj   s     r\   rp   zDeleteMany._add_to_client_bulk/  sR    "e  	OOLL0A 	 	
r[   r   r   r   r   r   r   s   @r\   r   r     sV    -I
 -1(,#'=!= *= &	=
 != 
=@

r[   r   c                  n    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
y)
ReplaceOnez#Represents a replace_one operation.)r   r`   _upsertr   r   ra   _sortNc                    |t        d|       |t        d|       |+t        |t              st	        j
                  |      | _        n|| _        || _        || _        || _	        || _
        || _        || _        y)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   upsert)r   r   r   r   r   r   r   r   r   r`   r   r   ra   )rc   r   replacementr   r   r   re   sorts           r\   rf   zReplaceOne.__init__K  sx    P &1Xv.JtS$9;I;Y;YZ^;_DJDJ
	##r[   c                    |j                  | j                  | j                  | j                  t	        | j
                        | j                  | j                         y)rh   r   r   r   N)add_replacer   r`   r   r   r   r   r   rj   s     r\   rl   zReplaceOne._add_to_bulk  sD    LLIILL0A 	 	
r[   c           	         | j                   st        d      |j                  | j                   | j                  | j                  | j
                  t        | j                        | j                  | j                         y)rn   ro   r   N)
ra   r   r   r   r`   r   r   r   r   r   rj   s     r\   rp   zReplaceOne._add_to_client_bulk  sd    "e  	OOLLIILL0A 	 	
r[   c                z   t        |      t        |       k(  r|j                  |j                  |j                  |j                  |j
                  |j                  |j                  f| j                  | j                  | j                  | j                  | j
                  | j                  | j                  fk(  S t        S ry   )	rz   r   r`   r   r   r   ra   r   r{   r|   s     r\   r~   zReplaceOne.__eq__  s    ;$t*$

     		



 " r[   c                    | |k(   S ry   rZ   r|   s     r\   r   zReplaceOne.__ne__  r   r[   c           
        | j                   rrdj                  | j                  j                  | j                  | j
                  | j                  | j                  | j                  | j                   | j                        S dj                  | 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   ru   r:   r   r`   r   r   r   r   rv   s    r\   rw   zReplaceOne.__repr__  s    ??AHH''		



	 	 8>>NN##LLIILLOOJJJJ
 	
r[   NNNNN)r   r   r   z%Union[_DocumentType, RawBSONDocument]r   Optional[bool]r   r   r   r   re   r   r   Optional[Mapping[str, Any]]r   r   r   r   r   r   )r:   r;   r<   r   r   rf   rl   rp   r~   r   rw   rZ   r[   r\   r   r   >  s    -I "&,0(,#',06$!6$ ;6$ 	6$
 *6$ &6$ !6$ *6$ 
6$p	

 *!
r[   r   c                  T    e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZd	dZd
dZddZy)	_UpdateOpz)Private base class for update operations.)r   r`   r   r   _array_filtersr   ra   r   c	                "   |t        d|       |t        d|       |t        d|       |+t        |t              st        j                  |      | _        n|| _        || _        || _	        || _
        || _        || _        || _        || _        y )Nr   r   array_filters)r   r   r   r   r   r   r   r   r   r`   r   r   r   ra   r   )	rc   r   docr   r   r   r   re   r   s	            r\   rf   z_UpdateOp.__init__  s     &1Xv.$/=9JtS$9;I;Y;YZ^;_DJDJ	#+#
r[   c           	        t        |t        |             r|j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  f| j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  fk(  S t        S ry   )r   rz   r   r`   r   r   r   r   ra   r   r{   r|   s     r\   r~   z_UpdateOp.__eq__  s    eT$Z(

  $$  	 		##



	 & r[   c                    | |k(   S ry   rZ   r|   s     r\   r   z_UpdateOp.__ne__  r   r[   c                   | j                   r}dj                  | j                  j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                   | j                  	      S dj                  | j                  j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                        S )Nz2{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})r   )ra   r   ru   r:   r   r`   r   r   r   r   r   rv   s    r\   rw   z_UpdateOp.__repr__  s    ??GNN''		##




 
 >DDNN##LLIILLOOJJJJ	
 		
r[   N)r   r   r   #Union[Mapping[str, Any], _Pipeline]r   r   r   r   r   !Optional[list[Mapping[str, Any]]]r   r   re   r   r   r   )r}   objectr   r   r   r   r   rZ   r[   r\   r   r     sn    3	I! 1 	
 * 9 & ! *:.!
r[   r   c                  h     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   c	           
     2    t         	|   ||||||||       y)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   )
rc   r   r3   r   r   r   r   re   r   ru   s
            r\   rf   zUpdateOne.__init__0  s#    ^ 	M4QZ\`ar[   c           
         |j                  | j                  | j                  dt        | j                        t        | j                        | j                  | j                  | j                         y)rh   Fr   r   r   r   N)

add_updater   r`   r   r   r   r   r   r   r   rj   s     r\   rl   zUpdateOne._add_to_bulka  sU    LLII0A-- 	 		
r[   c                   | j                   st        d      |j                  | j                   | j                  | j                  d| j
                  t        | j                        | j                  | j                  | j                  	       y)rn   ro   Fr   N)ra   r   r   r   r`   r   r   r   r   r   r   rj   s     r\   rp   zUpdateOne._add_to_client_bulkn  sp    "e  	OOLLIILL0A-- 	 
	
r[   )NNNNNN)r   r   r3   r   r   r   r   r   r   r   r   r   re   r   r   r   r   r   r   r   r   r   s   @r\   r   r   +  s    -I "&,0;?(,#',0/b!/b 4/b 	/b
 */b 9/b &/b !/b */b 
/bb

r[   r   c                  b     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   c           
     2    t         |   |||||||d       y)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   )	rc   r   r3   r   r   r   r   re   ru   s	           r\   rf   zUpdateMany.__init__  s#    T 	M4QZ\`ar[   c           	         |j                  | j                  | j                  d| j                  t	        | j
                        | j                  | j                         y)rh   Tr   r   r   N)r   r   r`   r   r   r   r   r   rj   s     r\   rl   zUpdateMany._add_to_bulk  sI    LLIILL0A-- 	 	
r[   c           
        | j                   st        d      |j                  | j                   | j                  | j                  d| j
                  t        | j                        | j                  | j                         y)rn   ro   Tr   N)
ra   r   r   r   r`   r   r   r   r   r   rj   s     r\   rp   zUpdateMany._add_to_client_bulk  si    "e  	OOLLIILL0A-- 	 		
r[   r   )r   r   r3   r   r   r   r   r   r   r   r   r   re   r   r   r   r   r   r   r   s   @r\   r   r     s    .I "&,0;?(,#'*b!*b 4*b 	*b
 **b 9*b &*b !*b 
*bX


r[   r   c                  6    e Zd ZdZdZddZedd       Zd	dZy)

IndexModelzRepresents an index to create.
__documentc                    t        |      }|j                  d      t        |      |d<   t        |      |d<   t	        |j                  dd            }|| _        ||| j                  d<   yy)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://mongodb.com/docs/master/core/index-wildcard/
        nameNkeyr   )r   getr   r   r   pop_IndexModel__document)rc   keyskwargsr   s       r\   rf   zIndexModel.__init__  so    z 4 ::f%,T2F6N'-u.vzz+t/LM	  +4DOOK( !r[   c                    | j                   S )zUAn index document suitable for passing to the createIndexes
        command.
        )r   rv   s    r\   rd   zIndexModel.document  s    
 r[   c                   dj                  | j                  j                  | j                  d   dj	                  | j                  j                         D cg c]  \  }}|dk7  sd| d| c}}            S c c}}w )Nz{}({}{})r    rs   =)r   ru   r:   rd   joinitemsrc   r   values      r\   rw   zIndexModel.__repr__"  sr      NN##MM% GGDMM<O<O<Qbjc5UX\aUar#ay)bc
 	
 cs   A;%
A;N)r   _IndexKeyHintr   r   r   r   )r   zdict[str, Any]r   	r:   r;   r<   r   r   rf   propertyrd   rw   rZ   r[   r\   r   r     s*    (ID5L  
r[   r   c                  N    e Zd ZdZdZ	 	 d	 	 	 	 	 	 	 	 	 ddZed	d       Zd
dZy)SearchIndexModelz$Represents a search index to create.r   Nc                    i | _         ||| j                   d<   || j                   d<   ||| j                   d<   | j                   j                  |       y)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   
definitionrz   )_SearchIndexModel__documentr3   )rc   r   r   rz   r   s        r\   rf   zSearchIndexModel.__init__/  sS    * +-&*DOOF#(2%&*DOOF#v&r[   c                    | j                   S )zThe document for this index.)r  rv   s    r\   rd   zSearchIndexModel.documentL  s     r[   c                    dj                  | j                  j                  dj                  | j                  j                         D cg c]  \  }}| d| c}}            S c c}}w )Nz{}({})rs   r   )r   ru   r:   r   rd   r   r   s      r\   rw   zSearchIndexModel.__repr__Q  sV    NN##IIDMM<O<O<QRjc5#ay)RS
 	
Rs   	A&)NN)
r   r   r   r   rz   r   r   r   r   r   )r   r   r   r   rZ   r[   r\   r   r   *  s`    .I
 #"	'%' ' 	'
 ' 
':  
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   r   int
_IndexListr   Enumr   r^   r   r   r   r   r   r   r   r   r   rZ   r[   r\   <module>r     sG   # 	 	 	 * " 8 = + P P B B 2B U3c5c7383D)D#EEFFGH'RUWZRZJ[[
 c:o&#tyy @2!& 2!j7c 7ct:
	 :
z:
 :
zL
' L
^[
 [
|S
	 S
lL
 L
^W
 W
t+
 +
r[   