Unify the host property between the Mongo and MultiRouter Mongo

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2026-02-02, CAR Team 2026-02-16
    • 🟦 Shard Catalog
    • None
    • None
    • None
    • None
    • None
    • None

      Context
      Currently the "host" property of the Mongo object returns a string in the format " <host1> : <port1>, <host2> : <port2> ... " for every host you originally attempted to connect.
      The mongo will be connected only to one of them. This property seems to mainly be used to remember the topology of the cluster. 

      Problem

      However, since we never really deployed a cluster with 2 mongoses or more (except for fsm tests), mongo.host property would always return one pair <host>:<port>. 
      The Mongo constructor support

      • one pair <host>:<port>
      • a list of pair <host>:<port> if a protocol (such as mongodb://) is present. 
        That means that in many places, such here  or here the Mongo constructor would fail if run against a multi-mongos deployment.

      Current Solution
      The Multi-Router (which should return a list of pair as for the Mongo) workarounds this issue by

      • returning a random pair of <host>:<port> picked from the pool
      • providing a property "hosts" that returns the correct list of hosts
        For FSM, we use "hosts" property in case of multi-router and "host" in case of mongo

      This solution cannot stay. We should ensure the Mongo supports a list of hosts correctly and remove the "hosts" property workaround in the multi-router.

            Assignee:
            Enrico Golfieri
            Reporter:
            Enrico Golfieri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: