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

Allow parsing of string literals in aggregation's $project

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • Aggregation Framework
    • Fully Compatible

    Description

      Currently a string literal as a value in a $project stage will cause an error:

      db.foo.aggregate([{$project: {a: "hi"}}])
      assert: command failed: {
      	"errmsg" : "exception: FieldPath 'hi' doesn't start with $",
      	"code" : 16873,
      	"ok" : 0
      } : aggregate failed
      Error: command failed: {
      	"errmsg" : "exception: FieldPath 'hi' doesn't start with $",
      	"code" : 16873,
      	"ok" : 0
      } : aggregate failed
          at Error (<anonymous>)
          at doassert (src/mongo/shell/assert.js:11:14)
          at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
          at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
          at (shell):1:8
      2016-02-02T12:12:03.131-0500 E QUERY    Error: command failed: {
      	"errmsg" : "exception: FieldPath 'hi' doesn't start with $",
      	"code" : 16873,
      	"ok" : 0
      } : aggregate failed
          at Error (<anonymous>)
          at doassert (src/mongo/shell/assert.js:11:14)
          at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
          at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
          at (shell):1:8 at src/mongo/shell/assert.js:13
      

      We should allow this, with the semantics that it creates or replaces a field, and has that string literal as its value.

      Attachments

        Issue Links

          Activity

            People

              backlog-server-query Backlog - Query Team (Inactive)
              charlie.swanson@mongodb.com Charlie Swanson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: