Skip to content

feat(db): add MongoDB client options #618

Closed

Description

@uniqueg

Problem

register_mongodb builds MongoClient(uri) with PyMongo defaults. serverSelectionTimeoutMS is 30 s, so with MongoDB down every request thread blocks for 30 s and startup hangs. Pool size, app name and TLS options can be set only through MONGO_URI.

Proposal

  • New db.client_options mapping (str to scalar), passed as MongoClient(**client_options). Keys are PyMongo's own option names; FOCA documents none of its own.
  • Default serverSelectionTimeoutMS: 5000 and connectTimeoutMS: 5000 when not set.
  • appname defaults to service_info.id (or the package name).
  • Options in MONGO_URI win, as in PyMongo; FOCA logs a warning on conflict.
  • Unknown options fail at MongoClient creation (fail-fast).

Acceptance criteria

  • Model field, defaults and pass-through covered by tests (100% coverage).
  • Docs (database configuration page) list the field, the defaults and the URI precedence.
  • Release notes/migration guide mention the changed default timeout (behaviour change, no API change).

The changed default has to land by 1.0.0-rc1.

Activity

  1. added this to the v0.21.0 milestone on Nov 3, 2026
  2. added
    priority: high
    status: triage
    type: feature
    workload: days
    on Nov 3, 2026
  3. added
    status: in progress
    and removed
    status: triage
    status: in progress
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: hightype: featureworkload: days

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions