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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Operating System:
      ALL

      Description

      $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

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: