connection
– Connection to MongoDB¶monguo.connection.
Connection
¶Manager the connnections.
connect
(db_name=None, connection_name=None, replica_set=False, *args, **kwargs)¶Connect to MongoDB.
Parameters: |
|
---|
disconnect
(connection_name=None)¶Disconnect the connection.
Parameters: |
|
---|
get_connection
(connection_name=None, pymongo=False)¶Get a connection, return None if the specified connection hasn’t been created.
Parameters: |
|
---|
get_connection_name_list
()¶Return the connections’ names.
get_database
(connection_name=None, db_name=None, pymongo=False)¶Get a database. If the specified connection_name hasn’t been created it will raise a ConnectionError.
Parameters: |
|
---|
get_default_connection_name
()¶Return the name of current connection.
get_default_database_name
()¶Return the name of current database.
switch_connection
(connection_name)¶Switch to the specified connection.
Parameters: |
|
---|
switch_database
(db_name)¶Switch to the specified database.
Parameters: |
|
---|