Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Classe « UpdateOne »

Constructeur pymongo.UpdateOne.__init__

Signature de la constructeur __init__

def __init__(self, filter: 'Mapping[str, Any]', update: 'Union[Mapping[str, Any], _Pipeline]', upsert: 'Optional[bool]' = None, collation: 'Optional[_CollationIn]' = None, array_filters: 'Optional[list[Mapping[str, Any]]]' = None, hint: 'Optional[_IndexKeyHint]' = None, namespace: 'Optional[str]' = None, sort: 'Optional[Mapping[str, Any]]' = None) -> 'None' 

Description

help(UpdateOne.__init__)

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.


Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé