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
    • 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:

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

      or

      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});
      

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

              Created:
              Updated:
              Resolved: