Allow parsing of string literals in aggregation's $project

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Query
    • Fully Compatible
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Backlog - Query Team (Inactive)
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: