Implement $listClusterCatalog using $_internalListCollections

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0, 8.0.10
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • v8.0
    • CAR Team 2024-11-11, CAR Team 2024-11-25, CAR Team 2024-12-09
    • 200
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Implement the aggregation stage $listClusterCatalog as an alias of the following pipeline (used to return the default values):

      [ 
       { $_internalListCollections: {} },
       { $lookup: {
                  from: {
                      db: "config",
                      coll: "collections"
                  },
                  localField: "_id",
                  foreignField: "name",
                  as: "trackedCollectionInfo" }},
       { $addFields: {
             "sharded": {
                       $and: [
                           {$ne: ["$trackedCollectionInfo", []]},
                           {$ne: [{$first: "$trackedCollectionInfo.unsplittable"}, true]}
                       ]
                   } }},
       { $addFields: {
                  "shardKey": {
                      $cond: {
                          if: "$sharded",
                          then: {$first: "$trackedCollectionInfo.key"},
                          else: "$$REMOVE"
                      }
                  }
       }}
      ]

       

      In addition, the aggregation stage will also return additional values if they are requested through the stage specifications.

      These are the extra fields that will be returned if the specified parameter is introduced:

      PARAMETER INTRODUCED OPTIONAL FIELD TYPE
      {shards: 1} shards array of strings
      {zoneRanges: 1} zoneRanges (opt) array of BSON
      {chunksInfo:1} chunks (opt) array of BSON
      {chunksInfo:1} chunkSize (opt) int
      {balancingConfiguration: 1} balancingEnabled (opt) boolean
      {balancingConfiguration: 1} autoMergingEnabled (opt) boolean
      {tracked: 1} tracked bool

            Assignee:
            Enrico Golfieri
            Reporter:
            Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: