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

Aggregation can trip invariant related to renamed fields optimization

    • Fully Compatible
    • ALL
    • v3.6
    • Hide

      Include these stages in the db.collection.aggregate method:

      1. Project a new field. The new field name should include a colon
      2. Project the new field onto itself, as well as onto a second new field. The second new field can have any name
      3. Perform a match on the second new field.

      Example:

      db.getCollection('archiveData').aggregate([
          {
              "$project": {
                  "foo:bar": "$foo",
              }
          }, {
              "$project": {
                  "foo:bar": "$foo:bar",
                  "baz": "$foo:bar",
              }
          }, {
              "$match": {
                  "baz": 1
              }
          }
      ])
      
      Show
      Include these stages in the db.collection.aggregate method: Project a new field. The new field name should include a colon Project the new field onto itself, as well as onto a second new field. The second new field can have any name Perform a match on the second new field. Example: db.getCollection( 'archiveData' ).aggregate([ { "$project" : { "foo:bar" : "$foo" , } }, { "$project" : { "foo:bar" : "$foo:bar" , "baz" : "$foo:bar" , } }, { "$match" : { "baz" : 1 } } ])
    • Query 2018-01-29

      Running certain db.collection.aggregate commands causes the mongod process to crash. Specifically, the crash seems to occur when field names contain a colon (:).

      Error output:

      2018-01-12T22:08:04.272+0000 E QUERY    [thread1] Error: error doing query: failed: network error while attempting to run command 'aggregate' on host '127.0.0.1:27017'  :
      DB.prototype.runCommand@src/mongo/shell/db.js:168:1
      DB.prototype.runReadCommand@src/mongo/shell/db.js:139:16
      DB.prototype._runAggregate/doAgg<@src/mongo/shell/db.js:239:60
      DB.prototype._runAggregate@src/mongo/shell/db.js:242:21
      DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1212:12
      @(shell):1:1
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            Aidan SE Mahler Aidan SE Mahler [X]
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: