[DOCS-7762] Comment on: "manual/reference/operator/aggregation/anyElementTrue.txt" Created: 27/Apr/16  Updated: 03/Nov/17  Resolved: 27/Apr/16

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.org/manual/reference/operator/aggregation/anyElementTrue/#exp._S_anyElementTrue
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Referrer: https://docs.mongodb.org/manual/reference/operator/aggregation/
Screen Resolution: 1366 x 768
repo: docs
source: reference/operator/aggregation/anyElementTrue


Participants:
Days since reply: 7 years, 42 weeks ago

 Description   

Mistakes.

[[]], [[0]], [[false]] won't resolve to "true", but to "false"

Cheers,
Pawel



 Comments   
Comment by Kay Kim (Inactive) [ 27/Apr/16 ]

the examples resolve to true per behavior

In addition to the false boolean value, $anyElementTrue evaluates as false the following: null, 0, and undefined values. The $anyElementTrue evaluates all other values as true, including non-zero numeric values and arrays.

An array of with one element – that happens to be an empty array – is still an array of element, ditto with his other examples.

The reporter may be getting the syntax:

{ $anyElementTrue: [ <expression> ] }

versus the <expression> itself resolving to an array;
i.e.

{ $anyElementTrue: [ 1, 2, 3 ] }  

vs

{ $anyElementTrue: [ [ ], [0], [false] ] } 

Will email reporter.

Generated at Thu Feb 08 07:54:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.