Module « pymongo »
Classe « MongoClient »
Informations générales
Héritage
builtins.object
BaseObject
MongoClient
Définition
class MongoClient (BaseObject):
Description [extrait de MongoClient.__doc__ ]
A client-side representation of a MongoDB cluster.
Instances can represent either a standalone MongoDB server, a replica
set, or a sharded cluster. Instances of this class are responsible for
maintaining up-to-date state of the cluster, and possibly cache
resources related to this, including background threads for monitoring,
and connection pools.
Constructeur(s)
Liste des attributs statiques
Liste des propriétés
address (host, port) of the current standalone, primary, or mongos, or None. [extrait de __doc__ ]
arbiters Arbiters in the replica set. [extrait de __doc__ ]
codec_options Read only access to the :class:`~bson.codec_options.CodecOptions` [extrait de __doc__ ]
event_listeners The event listeners registered for this client. [extrait de __doc__ ]
is_locked **DEPRECATED**: Is this server locked? While locked, all write [extrait de __doc__ ]
is_mongos If this client is connected to mongos. If the client is not [extrait de __doc__ ]
is_primary If this client is connected to a server that can accept writes. [extrait de __doc__ ]
local_threshold_ms The local threshold for this instance. [extrait de __doc__ ]
max_bson_size The largest BSON object the connected server accepts in bytes. [extrait de __doc__ ]
max_idle_time_ms The maximum number of milliseconds that a connection can remain [extrait de __doc__ ]
max_message_size The largest message the connected server accepts in bytes. [extrait de __doc__ ]
max_pool_size The maximum allowable number of concurrent connections to each [extrait de __doc__ ]
max_write_batch_size The maxWriteBatchSize reported by the server. [extrait de __doc__ ]
min_pool_size The minimum required number of concurrent connections that the pool [extrait de __doc__ ]
nodes Set of all currently connected servers. [extrait de __doc__ ]
primary The (host, port) of the current primary of the replica set. [extrait de __doc__ ]
read_concern Read only access to the :class:`~pymongo.read_concern.ReadConcern` [extrait de __doc__ ]
read_preference Read only access to the read preference of this instance. [extrait de __doc__ ]
retry_reads If this instance should retry supported write operations. [extrait de __doc__ ]
retry_writes If this instance should retry supported write operations. [extrait de __doc__ ]
secondaries The secondary members known to this client. [extrait de __doc__ ]
server_selection_timeout The server selection timeout for this instance in seconds. [extrait de __doc__ ]
topology_description The description of the connected MongoDB deployment. [extrait de __doc__ ]
write_concern Read only access to the :class:`~pymongo.write_concern.WriteConcern` [extrait de __doc__ ]
Opérateurs hérités de la classe object
__ge__ ,
__gt__ ,
__le__ ,
__lt__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
__enter__(self)
__exit__(self, exc_type, exc_val, exc_tb)
__getattr__(self, name)
Get a database by name. [extrait de __getattr__.__doc__ ]
__hash__(self)
__iter__(self)
__next__(self)
__repr__(self)
close(self)
Cleanup client resources and disconnect from MongoDB. [extrait de close.__doc__ ]
close_cursor(self, cursor_id, address=None)
DEPRECATED - Send a kill cursors message soon with the given id. [extrait de close_cursor.__doc__ ]
database_names(self, session=None)
**DEPRECATED**: Get a list of the names of all databases on the [extrait de database_names.__doc__ ]
drop_database(self, name_or_database, session=None)
Drop a database. [extrait de drop_database.__doc__ ]
fsync(self, **kwargs)
**DEPRECATED**: Flush all pending writes to datafiles. [extrait de fsync.__doc__ ]
get_database(self, name=None, codec_options=None, read_preference=None, write_concern=None, read_concern=None)
Get a :class:`~pymongo.database.Database` with the given name and [extrait de get_database.__doc__ ]
get_default_database(self, default=None, codec_options=None, read_preference=None, write_concern=None, read_concern=None)
Get the database named in the MongoDB connection URI. [extrait de get_default_database.__doc__ ]
kill_cursors(self, cursor_ids, address=None)
DEPRECATED - Send a kill cursors message soon with the given ids. [extrait de kill_cursors.__doc__ ]
list_database_names(self, session=None)
Get a list of the names of all databases on the connected server. [extrait de list_database_names.__doc__ ]
list_databases(self, session=None, **kwargs)
Get a cursor over the databases of the connected server. [extrait de list_databases.__doc__ ]
next(self)
server_info(self, session=None)
Get information about the MongoDB server we're connected to. [extrait de server_info.__doc__ ]
set_cursor_manager(self, manager_class)
DEPRECATED - Set this client's cursor manager. [extrait de set_cursor_manager.__doc__ ]
start_session(self, causal_consistency=None, default_transaction_options=None, snapshot=False)
Start a logical session. [extrait de start_session.__doc__ ]
unlock(self, session=None)
**DEPRECATED**: Unlock a previously locked server. [extrait de unlock.__doc__ ]
watch(self, pipeline=None, full_document=None, resume_after=None, max_await_time_ms=None, batch_size=None, collation=None, start_at_operation_time=None, session=None, start_after=None)
Watch changes on this cluster. [extrait de watch.__doc__ ]
Méthodes héritées de la classe BaseObject
__init_subclass__, __subclasshook__
Méthodes héritées de la classe object
__delattr__ ,
__dir__ ,
__format__ ,
__getattribute__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__str__
2024 © SARL Infini Software - Tous droits réservés
Mentions légales
Les informations présentes dans ce site vous sont fournies dans le but de vous aider à acquérir les compétences nécessaires à
l'utilisation des langages ou des technologies considérés. Infini Software ne pourra nullement être tenu responsable de l'utilisation
des informations présentes dans ce site.
De plus, si vous remarquez des erreurs ou des oublis dans ce document, n'hésitez surtout pas à nous le signaler en envoyant un mail
à l'adresse : .
Les autres marques et les noms de produits cités dans ces documents sont la propriété de leurs éditeurs respectifs.
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 :