Add optional settings extra using pydantic-settings

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Packaging
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Users configuring MongoClient from environment variables or .env files today do it by hand, with no validation or type coercion. Design gist: https://gist.github.com/blink1073/0d8cd1af7934eb6e0902603cb350068f

      Definition of done

      An optional pymongo[settings] extra is available that provides a typed, validated settings model (built on pydantic-settings) for configuring MongoClient/AsyncMongoClient from environment variables or .env files. The extra is opt-in and adds no hard dependency to core PyMongo.

      Pitfalls

      Avoid colliding with the existing internal pymongo/synchronous/settings.py and pymongo/asynchronous/settings.py modules, which are unrelated. Keep the field set curated rather than mirroring every MongoClient option, to limit future maintenance burden as options evolve.

            Assignee:
            Unassigned
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: