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

Document array behaviour in aggregate pipelines.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.6.5
    • Component/s: Aggregation Framework
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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

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

              Created:
              Updated:
              Resolved: