Uploaded image for project: 'Python Integrations'
  1. Python Integrations
  2. INTPYTHON-424

[Django] Support passing URLs via django_mongodb.parse

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • django-mongodb-5.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Completed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Based on the documentation provided on github:

      ```

      Configuring the DATABASES setting

      https://github.com/mongodb-labs/django-mongodb#configuring-the-databases-setting
      After you've set up a project, configure Django's DATABASES setting similar to this:
      DATABASES = { "default":

      { "ENGINE": "django_mongodb", "NAME": "my_database", "USER": "my_user", "PASSWORD": "my_password", "OPTIONS": \{...}

      , }, }
       
      OPTIONS is an optional dictionary of parameters that will be passed to MongoClient.
      ```

      This works fine on a local definition, but can quickly be confusing for someone connecting to atlas. A typical atlas user would place their URI into the "host" section and leave it as is. Here, an end-user would have to pass their MongoDB URI into the `host` section (usually this already contains the user:password authentication) and then, additionally, add in the user/password components in the dictionary.

      It miscommunicates URI construction. If one were to try and connect to an atlas cluster, they would either have to:

      1. Have to manually parse the URI and break it into components
      2. Be unable to provide the `pymongo+srv` protocol somewhere in the URI construction (because 'host' colloquially is closer to 'hostname' defined for Django)
      3. Pass the URI completely and then pass the user and password.

      We need to change the instructions we give users outside of "use the dj-database-url" and make sure we still make it simple enough to connect to a mongodb cluster.

            Assignee:
            alex.clark@mongodb.com Alex Clark
            Reporter:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: