+
    4O|ji  ã                  ó^   € R t ^ RIHt ^ RIHtHtHt  ! R R4      t ! R R4      tR R lt	R	# )
a
  Support for MongoDB Stable API.

.. _versioned-api-ref:

MongoDB Stable API
=====================

Starting in MongoDB 5.0, applications can specify the server API version
to use when creating a :class:`~pymongo.mongo_client.MongoClient`. Doing so
ensures that the driver behaves in a manner compatible with that server API
version, regardless of the server's actual release version.

Declaring an API Version
````````````````````````

.. attention:: Stable API requires MongoDB >=5.0.

To configure MongoDB Stable API, pass the ``server_api`` keyword option to
:class:`~pymongo.mongo_client.MongoClient`::

    >>> from pymongo.mongo_client import MongoClient
    >>> from pymongo.server_api import ServerApi
    >>>
    >>> # Declare API version "1" for MongoClient "client"
    >>> server_api = ServerApi('1')
    >>> client = MongoClient(server_api=server_api)

The declared API version is applied to all commands run through ``client``,
including those sent through the generic
:meth:`~pymongo.database.Database.command` helper.

.. note:: Declaring an API version on the
   :class:`~pymongo.mongo_client.MongoClient` **and** specifying stable
   API options in :meth:`~pymongo.database.Database.command` command document
   is not supported and will lead to undefined behaviour.

To run any command without declaring a server API version or using a different
API version, create a separate :class:`~pymongo.mongo_client.MongoClient`
instance.

Strict Mode
```````````

Configuring ``strict`` mode will cause the MongoDB server to reject all
commands that are not part of the declared :attr:`ServerApi.version`. This
includes command options and aggregation pipeline stages.

For example::

    >>> server_api = ServerApi('1', strict=True)
    >>> client = MongoClient(server_api=server_api)
    >>> client.test.command('count', 'test')
    Traceback (most recent call last):
    ...
    pymongo.errors.OperationFailure: Provided apiStrict:true, but the command count is not in API Version 1, full error: {'ok': 0.0, 'errmsg': 'Provided apiStrict:true, but the command count is not in API Version 1', 'code': 323, 'codeName': 'APIStrictError'

Detecting API Deprecations
``````````````````````````

The ``deprecationErrors`` option can be used to enable command failures
when using functionality that is deprecated from the configured
:attr:`ServerApi.version`. For example::

    >>> server_api = ServerApi('1', deprecation_errors=True)
    >>> client = MongoClient(server_api=server_api)

Note that at the time of this writing, no deprecated APIs exist.

Classes
=======
)Úannotations)ÚAnyÚMutableMappingÚOptionalc                  ó   € ] tR t^[tRtRtRtR# )ÚServerApiVersionzSAn enum that defines values for :attr:`ServerApi.version`.

.. versionadded:: 3.12
Ú1© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚV1Ú__static_attributes__r	   ó    ÚKC:\Users\alokc\chatbot\backend\venv\Lib\site-packages\pymongo/server_api.pyr   r   [   s   † ñð
 
€BÛ!r   r   c                  ól   € ] tR t^etRtRR R llt]R R l4       t]R R l4       t]R	 R
 l4       t	Rt
R# )Ú	ServerApizMongoDB Stable API.Nc               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚversionÚstrÚstrictúOptional[bool]Údeprecation_errorsr	   )Úformats   "r   Ú__annotate__ÚServerApi.__annotate__h   s$   € ÷ 6ñ 6Øð6Ø$2ð6ØO]ñ6r   c                ó4  € V\         P                  8w  d   \        RV 24      hVe.   \        V\        4      '       g   \        R\        V4       24      hVe.   \        V\        4      '       g   \        R\        V4       24      hWn        W n        W0n	        R# )a¯  Options to configure MongoDB Stable API.

:param version: The API version string. Must be one of the values in
    :class:`ServerApiVersion`.
:param strict: Set to ``True`` to enable API strict mode.
    Defaults to ``None`` which means "use the server's default".
:param deprecation_errors: Set to ``True`` to enable
    deprecation errors. Defaults to ``None`` which means "use the
    server's default".

.. versionadded:: 3.12
zUnknown ServerApi version: NzHWrong type for ServerApi strict, value must be an instance of bool, not zTWrong type for ServerApi deprecation_errors, value must be an instance of bool, not )
r   r   Ú
ValueErrorÚ
isinstanceÚboolÚ	TypeErrorÚtypeÚ_versionÚ_strictÚ_deprecation_errors)Úselfr   r   r   s   &&&&r   Ú__init__ÚServerApi.__init__h   s¤   € ð Ô&×)Ñ)Ô)ÜÐ:¸7¸)ÐDÓEÐEØÒ¤j°¼×&>Ò&>Üð Ü $ V£˜~ð/óð ð Ò)´*Ð=OÔQU×2VÒ2VÜð,Ü,0Ð1CÓ,DÐ+EðGóð ð  ŒØŒØ#5Ö r   c               ó   € V ^8„  d   QhRR/# )r   Úreturnr   r	   )r   s   "r   r   r   ˆ   s   € ÷ ñ ˜ñ r   c                ó   € V P                   # )zVThe API version setting.

This value is sent to the server in the "apiVersion" field.
)r%   ©r(   s   &r   r   ÚServerApi.version‡   s   € ð �}‰}Ðr   c               ó   € V ^8„  d   QhRR/# ©r   r,   r   r	   )r   s   "r   r   r   �   s   € ÷ ñ ˜ñ r   c                ó   € V P                   # )zcThe API strict mode setting.

When set, this value is sent to the server in the "apiStrict" field.
)r&   r.   s   &r   r   ÚServerApi.strict�   s   € ð �|‰|Ðr   c               ó   € V ^8„  d   QhRR/# r1   r	   )r   s   "r   r   r   ˜   s   € ÷ (ñ ( Nñ (r   c                ó   € V P                   # )zuThe API deprecation errors setting.

When set, this value is sent to the server in the
"apiDeprecationErrors" field.
)r'   r.   s   &r   r   ÚServerApi.deprecation_errors—   s   € ð ×'Ñ'Ð'r   )r'   r&   r%   )NN)r
   r   r   r   r   r)   Úpropertyr   r   r   r   r	   r   r   r   r   e   sF   † Ù÷6ð> ôó ðð ôó ðð ô(ó ô(r   r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚcmdzMutableMapping[str, Any]Ú
server_apizOptional[ServerApi]r,   ÚNoner	   )r   s   "r   r   r   ¡   s)   € ÷ Dñ DÐ1ð DÐ?Rð DÐW[ñ Dr   c                ó°   € V'       g   R# VP                   V R&   VP                  e   VP                  V R&   VP                  e   VP                  V R&   R# R# )z�Internal helper which adds API versioning options to a command.

:param cmd: The command.
:param server_api: A :class:`ServerApi` or ``None``.
NÚ
apiVersionÚ	apiStrictÚapiDeprecationErrors)r   r   r   )r9   r:   s   &&r   Ú_add_to_commandr@   ¡   sX   € ÷ ÙØ"×*Ñ*€CˆÑØ×ÑÒ$Ø%×,Ñ,ˆˆKÑØ×$Ñ$Ò0Ø&0×&CÑ&CˆÐ"Ó#ñ 1r   N)
r   Ú
__future__r   Útypingr   r   r   r   r   r@   r	   r   r   Ú<module>rC      s2   ðñFõN #ç 0Ñ 0÷"ñ "÷9(ñ 9(÷xDr   