$project does not allow creation of a new field with literal value

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.1.1
    • Component/s: Aggregation Framework
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      $project allows insertion of new computed fields, however it doesn't seem to allow insertion of new literal fields.

      {$project : {"newfield":"abc"}}
      gives "errmsg" : "exception: field path references must be prefixed with a '$' (\"abc\""

      It would be nice to not have to hack around it via:
      {$project : {"newfield": {$add: ["abc",""]}}}

      Possibly related to https://jira.mongodb.org/browse/SERVER-5762 and https://jira.mongodb.org/browse/SERVER-5782

            Assignee:
            Mathias Stearn
            Reporter:
            Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: