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

$getField accepts all input types and treats all non-object ones as null-ish

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • ALL

      db.getFieldTest.aggregate(\{$project:{o1:{$getField:{input:"$_id", field:"x"}}}})
      { "_id" : ObjectId("66e8738aee1179b743aff3cd") }
      { "_id" : ObjectId("66e87391ee1179b743aff3ce") }
      
      

      All non-objects seem to lead to same outcome.  Design doc said:

      The ‘input’ argument is optional and defaults to $$CURRENT. A query fatal exception is thrown if it evaluates to anything other than missing, null, undefined, or Object. 

            Assignee:
            Unassigned Unassigned
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: