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 ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Classe « AsyncMongoClient »

Méthode pymongo.AsyncMongoClient.get_database

Signature de la méthode get_database

def get_database(self, name: 'Optional[str]' = None, codec_options: 'Optional[CodecOptions[_DocumentTypeArg]]' = None, read_preference: 'Optional[_ServerMode]' = None, write_concern: 'Optional[WriteConcern]' = None, read_concern: 'Optional[ReadConcern]' = None) -> 'database.AsyncDatabase[_DocumentType]' 

Description

help(AsyncMongoClient.get_database)

Get a :class:`~pymongo.asynchronous.database.AsyncDatabase` with the given name and
options.

Useful for creating a :class:`~pymongo.asynchronous.database.AsyncDatabase` with
different codec options, read preference, and/or write concern from
this :class:`AsyncMongoClient`.

  >>> client.read_preference
  Primary()
  >>> db1 = client.test
  >>> db1.read_preference
  Primary()
  >>> from pymongo import ReadPreference
  >>> db2 = client.get_database(
  ...     'test', read_preference=ReadPreference.SECONDARY)
  >>> db2.read_preference
  Secondary(tag_sets=None)

:param name: The name of the database - a string. If ``None``
    (the default) the database named in the MongoDB connection URI is
    returned.
:param codec_options: An instance of
    :class:`~bson.codec_options.CodecOptions`. If ``None`` (the
    default) the :attr:`codec_options` of this :class:`AsyncMongoClient` is
    used.
:param read_preference: The read preference to use. If
    ``None`` (the default) the :attr:`read_preference` of this
    :class:`AsyncMongoClient` is used. See :mod:`~pymongo.read_preferences`
    for options.
:param write_concern: An instance of
    :class:`~pymongo.write_concern.WriteConcern`. If ``None`` (the
    default) the :attr:`write_concern` of this :class:`AsyncMongoClient` is
    used.
:param read_concern: An instance of
    :class:`~pymongo.read_concern.ReadConcern`. If ``None`` (the
    default) the :attr:`read_concern` of this :class:`AsyncMongoClient` is
    used.

.. versionchanged:: 3.5
   The `name` parameter is now optional, defaulting to the database
   named in the MongoDB connection URI.


Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé