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

Allow parsing of string literals in aggregation's $project

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

      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-server-query Backlog - Query Team (Inactive)
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: