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_default_database

Signature de la méthode get_default_database

def get_default_database(self, default: '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_default_database)

Get the database named in the MongoDB connection URI.

>>> uri = 'mongodb://host/my_database'
>>> client = AsyncMongoClient(uri)
>>> db = client.get_default_database()
>>> assert db.name == 'my_database'
>>> db = client.get_database()
>>> assert db.name == 'my_database'

Useful in scripts where you want to choose which database to use
based only on the URI in a configuration file.

:param default: the database name to use if no database name
    was provided in the URI.
: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.
:param comment: A user-provided comment to attach to this
    command.

.. versionchanged:: 4.1
   Added ``comment`` parameter.

.. versionchanged:: 3.8
   Undeprecated. Added the ``default``, ``codec_options``,
   ``read_preference``, ``write_concern`` and ``read_concern``
   parameters.

.. versionchanged:: 3.5
   Deprecated, use :meth:`get_database` instead.


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