INTPYTHON-509 Add db_name parameter to parse_uri()#249
Merged
timgraham merged 1 commit intomongodb:mainfrom Feb 24, 2025
Merged
INTPYTHON-509 Add db_name parameter to parse_uri()#249timgraham merged 1 commit intomongodb:mainfrom
timgraham merged 1 commit intomongodb:mainfrom
Conversation
Collaborator
Author
|
@R-shubham do you want to ask those who ran into this if the error message makes sense? |
Jibola
requested changes
Feb 4, 2025
bdb8625 to
4911208
Compare
4911208 to
28426f7
Compare
Collaborator
Author
|
Documentation edits (pending #233): diff --git a/docs/source/ref/utils.rst b/docs/source/ref/utils.rst
index 16a6116..a5fb8ff 100644
--- a/docs/source/ref/utils.rst
+++ b/docs/source/ref/utils.rst
@@ -12,7 +12,7 @@ following parts can be considered stable.
``parse_uri()``
===============
-.. function:: parse_uri(uri, conn_max_age=0, test=None)
+.. function:: parse_uri(uri, db_name=None, conn_max_age=0, test=None)
Parses a MongoDB `connection string`_ into a dictionary suitable for Django's
:setting:`DATABASES` setting.
@@ -23,8 +23,11 @@ Example::
import django_mongodb_backend
- MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/myDatabase?retryWrites=true&w=majority&tls=false"
- DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI)
+ MONGODB_URI = "mongodb+srv://my_user:my_password@cluster0.example.mongodb.net/defaultauthdb?retryWrites=true&w=majority&tls=false"
+ DATABASES["default"] = django_mongodb_backend.parse_uri(MONGODB_URI, db_name="example")
+
+You must specify ``db_name`` (the :setting:`NAME` of your database) if the URI
+doesn't specify ``defaultauthdb``.
You can use the parameters to customize the resulting :setting:`DATABASES`
setting: |
Jibola
approved these changes
Feb 11, 2025
28426f7 to
6240b1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.