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

db.watch does not show up in autocomplete or help

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.2.0
    • Component/s: Shell
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0
    • Sprint:
      Query 2019-06-03
    • Linked BF Score:
      0

      Description

      In the shell, the autocomplete list for a db object does not include the watch helper.

      It looks like the autocomplete function finds properties on an object using Object.keySet, defined here which iterates over enumerable properties.

      Object.getOwnPropertyDescriptor shows that the watch property is not enumerable:

      Object.getOwnPropertyDescriptor(db, "watch")
      {
      	"value" : function (pipeline, options) {
              pipeline = pipeline || [];
              options = options || {};
              assert(pipeline instanceof Array, "'pipeline' argument must be an array");
              assert(options instanceof Object, "'options' argument must be an object");
       
              let changeStreamStage = {fullDocument: options.fullDocument || "default"};
              delete options.fullDocument;
       
              if (options.hasOwnProperty("resumeAfter")) {
                  changeStreamStage.resumeAfter = options.resumeAfter;
                  delete options.resumeAfter;
              }
       
              if (options.hasOwnProperty("startAtOperationTime")) {
                  changeStreamStage.startAtOperationTime = options.startAtOperationTime;
                  delete options.startAtOperationTime;
              }
       
              pipeline.unshift({$changeStream: changeStreamStage});
              return this._runAggregate({aggregate: 1, pipeline: pipeline}, options);
          },
      	"writable" : true,
      	"enumerable" : false,
      	"configurable" : true
      }
      

      But I'm not sure why watch is not enumerable while other similarly defined properties like getFreeMonitoringStatus are.

      Additionally, db.watch does not show up in the output of db.help().

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              kevin.albertson Kevin Albertson
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: