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

operator/aggrestion/*ElementsTrue example results: null instead of undefined

    XMLWordPrintableJSON

Details

    Description

      Description

      In the example of https://docs.mongodb.org/manual/reference/operator/aggregation/allElementsTrue/#exp._S_allElementsTrue , the command

      db.survey.aggregate([
         { $project: { responses: 1, isAllTrue: { $allElementsTrue: [ "$responses" ] }, _id: 0 } }
      ])
      

      should return the result

      ...
       
      { "responses" : [ {color:#ff0000}undefined{color} ], "isAllTrue" : false }
      { "responses" : [ null ], "isAllTrue" : false }
      

      instead of the documented result

      ...
       
      { "responses" : [ {color:#ff0000}null{color} ], "isAllTrue" : false }
      { "responses" : [ null ], "isAllTrue" : false }
      

       

      The same bug also applies for

      https://docs.mongodb.org/manual/reference/operator/aggregation/anyElementTrue/#exp._S_anyElementTrue

       

      Scope of changes

      • Validate bug
      • apply to 3.2+   (3.0 and earlier shell would return null as documented – see DOCS-6579 / SERVER-6102

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            jetf Jet Feng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              4 years, 16 weeks, 1 day ago