Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-96213

Implement $listClusterCatalog using $_internalListCollections

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

      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@mongodb.com Enrico Golfieri
            Reporter:
            silvia.surroca@mongodb.com Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: