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 ? Programmation Python
Les compléments
Voir le programme détaillé
Classe « ReadPreference »

Méthode pymongo.ReadPreference.PRIMARY_PREFERRED

Signature de la méthode PRIMARY_PREFERRED

def PRIMARY_PREFERRED(selection: 'Selection') -> 'Selection' 

Description

help(ReadPreference.PRIMARY_PREFERRED)

PrimaryPreferred read preference.

* When directly connected to one mongod queries are allowed to standalone
  servers, to a replica set primary, or to replica set secondaries.
* When connected to a mongos queries are sent to the primary of a shard if
  available, otherwise a shard secondary.
* When connected to a replica set queries are sent to the primary if
  available, otherwise a secondary.

.. note:: When a :class:`~pymongo.mongo_client.MongoClient` is first
  created reads will be routed to an available secondary until the
  primary of the replica set is discovered.

:param tag_sets: The :attr:`~tag_sets` to use if the primary is not
    available.
:param max_staleness: (integer, in seconds) The maximum estimated
    length of time a replica set secondary can fall behind the primary in
    replication before it will no longer be selected for operations.
    Default -1, meaning no maximum. If it is set, it must be at least
    90 seconds.
:param hedge: The :attr:`~hedge` to use if the primary is not available.

.. versionchanged:: 3.11
   Added ``hedge`` parameter.


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