Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-2341

Clarify $ifNull Behavior on Non-Existent Document Field

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • None
    • manual
    • None

    Description

      http://docs.mongodb.org/manual/reference/operator/aggregation/ifNull/#ifnull-aggregation

      Consider

      {$ifNull:["$thisFieldDoesNotExist",true]}

      seems to consider the value of "$thisFieldDoesNotExist" as being null, so the expression evaluates to true.

      Assuming this behavior is consistent across all Aggregation Framework-enabled versions, it'd be good to explicitly state this or include an example that shows this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            stephen.lee Stephen Lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 11 weeks ago