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

Document array behaviour in aggregate pipelines.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.6.5
    • Aggregation Framework
    • None
    • ALL

    Description

      The following confuses me:

      Data:

      db.foo.insert({name: "Hello"})

      Operation:

      db.foo.aggregate({$project: { "_id": 0, "Hello" : {$map: {input: ["$name"],  as: "whee", in: "$$whee"} } }})

      Result:

      { "Hello" : [ "$name" ] }

      Somehow I would have expected $name to be expanded to "Hello".
      I'm sure there's a good reason that doesn't happen, but I couldn't find anything on the site that explains exactly what's going on here

      Attachments

        Activity

          People

            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            jcranend Jeroen Cranendonk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: