[DOCS-12536] operator/aggrestion/*ElementsTrue example results: null instead of undefined Created: 10/Mar/19  Updated: 30/Oct/23  Resolved: 23/Oct/19

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: 3.6.1
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Minor - P4
Reporter: Jet Feng Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 4 years, 16 weeks, 1 day ago
Epic Link: DOCSP-1769
Story Points: 0.1

 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

 



 Comments   
Comment by Kay Kim (Inactive) [ 23/Oct/19 ]

Thank you for filing this ticket. Will publish the fix tomorrow morning.

Comment by Githook User [ 23/Oct/19 ]

Author:

{'username': 'kay-kim', 'email': 'kay.kim@10gen.com', 'name': 'Kay Kim'}

Message: DOCS-12536: 3.2+ mongo shell allElementsTrue/anyElementTrue example - update example as undefined no longer maps to null
Branch: v3.2
https://github.com/mongodb/docs/commit/9b1ccebb24383257ecb2635fe63805b73bfac1a5

Comment by Githook User [ 23/Oct/19 ]

Author:

{'name': 'Kay Kim', 'username': 'kay-kim', 'email': 'kay.kim@10gen.com'}

Message: DOCS-12536: 3.2+ mongo shell allElementsTrue/anyElementTrue example - update example as undefined no longer maps to null
Branch: v3.4
https://github.com/mongodb/docs/commit/3a6be255410faee5c0b3b50d78368a9ea5c2d2f3

Comment by Githook User [ 23/Oct/19 ]

Author:

{'name': 'Kay Kim', 'username': 'kay-kim', 'email': 'kay.kim@10gen.com'}

Message: DOCS-12536: 3.2+ mongo shell allElementsTrue/anyElementTrue example - update example as undefined no longer maps to null
Branch: v3.6
https://github.com/mongodb/docs/commit/65ad99cf01508810229703444422bbf0fde066a5

Comment by Githook User [ 23/Oct/19 ]

Author:

{'username': 'kay-kim', 'email': 'kay.kim@10gen.com', 'name': 'Kay Kim'}

Message: DOCS-12536: 3.2+ mongo shell allElementsTrue/anyElementTrue example - update example as undefined no longer maps to null
Branch: v4.0
https://github.com/mongodb/docs/commit/16d5641653aadf02304b40b6941f00ef3087936e

Comment by Githook User [ 23/Oct/19 ]

Author:

{'name': 'Kay Kim', 'username': 'kay-kim', 'email': 'kay.kim@10gen.com'}

Message: DOCS-12536: 3.2+ mongo shell allElementsTrue/anyElementTrue example - update example as undefined no longer maps to null
Branch: master
https://github.com/mongodb/docs/commit/b57e007d327de8a61418305295e199fbf4246e09

Generated at Thu Feb 08 08:05:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.