Add db parameter to register_connection
This is done to make it compatible with the connect function.
This commit is contained in:
		| @@ -9,6 +9,7 @@ dev | |||||||
| -  Improve LazyReferenceField and GenericLazyReferenceField with nested fields #1704 | -  Improve LazyReferenceField and GenericLazyReferenceField with nested fields #1704 | ||||||
| -  Fix validation error instance in GenericEmbeddedDocumentField #1067 | -  Fix validation error instance in GenericEmbeddedDocumentField #1067 | ||||||
| -  Update cached fields when fields argument is given #1712 | -  Update cached fields when fields argument is given #1712 | ||||||
|  | -  Add a db parameter to register_connection for compatibility with connect | ||||||
|  |  | ||||||
| Changes in 0.15.0 | Changes in 0.15.0 | ||||||
| ================= | ================= | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ _connections = {} | |||||||
| _dbs = {} | _dbs = {} | ||||||
|  |  | ||||||
|  |  | ||||||
| def register_connection(alias, name=None, host=None, port=None, | def register_connection(alias, db=None, name=None, host=None, port=None, | ||||||
|                         read_preference=READ_PREFERENCE, |                         read_preference=READ_PREFERENCE, | ||||||
|                         username=None, password=None, |                         username=None, password=None, | ||||||
|                         authentication_source=None, |                         authentication_source=None, | ||||||
| @@ -39,6 +39,7 @@ def register_connection(alias, name=None, host=None, port=None, | |||||||
|     :param alias: the name that will be used to refer to this connection |     :param alias: the name that will be used to refer to this connection | ||||||
|         throughout MongoEngine |         throughout MongoEngine | ||||||
|     :param name: the name of the specific database to use |     :param name: the name of the specific database to use | ||||||
|  |     :param db: the name of the database to use, for compatibility with connect | ||||||
|     :param host: the host name of the :program:`mongod` instance to connect to |     :param host: the host name of the :program:`mongod` instance to connect to | ||||||
|     :param port: the port that the :program:`mongod` instance is running on |     :param port: the port that the :program:`mongod` instance is running on | ||||||
|     :param read_preference: The read preference for the collection |     :param read_preference: The read preference for the collection | ||||||
| @@ -58,7 +59,7 @@ def register_connection(alias, name=None, host=None, port=None, | |||||||
|     .. versionchanged:: 0.10.6 - added mongomock support |     .. versionchanged:: 0.10.6 - added mongomock support | ||||||
|     """ |     """ | ||||||
|     conn_settings = { |     conn_settings = { | ||||||
|         'name': name or 'test', |         'name': name or db or 'test', | ||||||
|         'host': host or 'localhost', |         'host': host or 'localhost', | ||||||
|         'port': port or 27017, |         'port': port or 27017, | ||||||
|         'read_preference': read_preference, |         'read_preference': read_preference, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user