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

Comment option in aggregation does not seem to produce effect

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.12
    • Component/s: Aggregation Framework
    • Labels:
      None
    • ALL
    • Hide

      Mongo 3.6

      db.setProfilingLevel(2);db.movies.insert({ "title" : "Jaws", "year" : 1995, "imdb" : "tt0073195" });
      db.movies.insert({ "title" : "A Clockwork Orange", "year" : 1971, "imdb" : "tt0066921" });

      The aggregation

       

      {{db.movies.aggregate( [ { $match:

      { year : 1995 }

      } ], { comment : "year_95_query" } );}}

       

       

      is shown in system.profile as follows:

      {{}}{{{ }}
      {{ "op" : "command", }}
      {{ "ns" : "movies.movies", }}
      {{ "command" : {}}
      {{ "aggregate" : "movies", }}
      {{ "pipeline" : [ { "$match" :

      { "year" : 1995 }

      } ], }}
      {{ "cursor" : { }, }}
      {{ "$db" : "movies", }}
      {{ "$readPreference" : { "mode" : "primaryPreferred" }}}
      {{ }, }}
      {{ "keysExamined" : 0, }}
      {{ "docsExamined" : 2, }}
      ...

       

       

      Where the old $comment in a $match stage

       

      {{db.movies.aggregate( [ { $match:

      { year : 1995, $comment : "year_95_query" }

      } ] );}}

       

      is shown as:

       

      {{{ }}
      {{ "op" : "command", }}
      {{ "ns" : "movies.movies", }}
      {{ "command" : {}}
      {{ "aggregate" : "movies", }}
      {{ "pipeline" : [ { "$match" :

      { "year" : 1995 }

      } ], }}
      {{ "cursor" : { }, }}
      {{ "$db" : "movies", }}
      {{ "$readPreference" : { "mode" : "primaryPreferred" }}}
      {{ }, }}
      {{ "keysExamined" : 0, }}
      {{ "docsExamined" : 2, }}
      {{ ...}}

      Show
      Mongo 3.6 db.setProfilingLevel(2); db.movies.insert({ "title" : "Jaws", "year" : 1995, "imdb" : "tt0073195" }); db.movies.insert({ "title" : "A Clockwork Orange", "year" : 1971, "imdb" : "tt0066921" }); The aggregation   {{db.movies.aggregate( [ { $match: { year : 1995 } } ], { comment : "year_95_query" } );}}     is shown in system.profile as follows: {{}}{{{ }} {{ "op" : "command", }} {{ "ns" : "movies.movies", }} {{ "command" : {}} {{ "aggregate" : "movies", }} {{ "pipeline" : [ { "$match" : { "year" : 1995 } } ], }} {{ "cursor" : { }, }} {{ "$db" : "movies", }} {{ "$readPreference" : { "mode" : "primaryPreferred" }}} {{ }, }} {{ "keysExamined" : 0, }} {{ "docsExamined" : 2, }} ...     Where the old $comment in a $match stage   {{db.movies.aggregate( [ { $match: { year : 1995, $comment : "year_95_query" } } ] );}}   is shown as:   {{{ }} {{ "op" : "command", }} {{ "ns" : "movies.movies", }} {{ "command" : {}} {{ "aggregate" : "movies", }} {{ "pipeline" : [ { "$match" : { "year" : 1995 } } ], }} {{ "cursor" : { }, }} {{ "$db" : "movies", }} {{ "$readPreference" : { "mode" : "primaryPreferred" }}} {{ }, }} {{ "keysExamined" : 0, }} {{ "docsExamined" : 2, }} {{ ...}}

      The docs say the comment option's string should appear like this:
      {{{
      "op" : "command",
      "ns" : "movies.movies",
      "command" : {
      "aggregate" : "movies",
      "pipeline" : [
      {
      "$match" :

      { "year" : 1995 }

      }
      ],
      "comment" : "year_95_query",
      "cursor" : {}}

       

      But the comment string is nowhere to be seen in system.profile

            Assignee:
            eric.sedor@mongodb.com Eric Sedor
            Reporter:
            danirod Dani
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: