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

Allow planCacheListPlans to accept the shape as an object

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6.0-rc1
    • Affects Version/s: 2.6.0-rc0
    • Component/s: Querying, Shell
    • Labels:
    • Fully Compatible

      The planCacheListPlans command is useful for displaying cached candidate plans for a given query shape, which is specified by query, sort and projection parameters. However, the query shape will often be collected from the planCacheListQueryShapes command, which returns an array of objects. This makes it difficult to pass the results directly to planCacheListPlans (although they can be copy/pasted).

      Currently, the workflow may look something like this:

      ... <copy the fields of the shape object> ...
      db.runCommand({planCacheListQueryShapes:'collectionName', <paste the shape object fields>});


      var shape = db.runCommand({planCacheListQueryShapes:'collectionName'}).shapes[0];
      db.runCommand({planCacheListPlans:'collectionName', query: shape.query, sort: shape.sort, projection: shape.projection});

      To simplify automation and usability, it would be helpful to allow planCacheListQueryShapes to accept an object with query/sort/projection fields instead of individual parameters; e.g.:

      var shape = db.runCommand({planCacheListQueryShapes:'collectionName'}).shapes[0];
      db.runCommand({planCacheListQueryShapes:'collectionName', shape});

            benety.goh@mongodb.com Benety Goh
            benjamin.becker Ben Becker
            0 Vote for this issue
            3 Start watching this issue