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

get value from document using expression

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None

      can we hav an aggregation operator like "$arrayElemAt" 
      but instead of working on array the input is a document

      { $elemAt: [ <document>, <key> ] }

      The <document> expression can be any valid expression as long as it resolves to a document.

      The <key> expression can be any valid expression as long as it resolves to a String.

       

      Behavio

      Example     ->     Results

      { $elemAt: [ \{k1:"v1",k2:"v2"}

      , "k1" ] }   -> "v1"

      { $elemAt: [ \{k1:"v1",k2:"v2"}

      , "k3" ] }   -> null 

            Assignee:
            nick.brewer Nick Brewer
            Reporter:
            yassineKarim yassine Karim [X]
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: