[DOCS-8084] Comment on: "manual/reference/operator/aggregation/and.txt" Created: 12/Jun/16  Updated: 03/Nov/17  Resolved: 13/Jun/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.com/manual/reference/operator/aggregation/and/#exp._S_and
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
Referrer: https://docs.mongodb.com/manual/reference/operator/aggregation/
Screen Resolution: 1600 x 900


Participants:
Days since reply: 7 years, 35 weeks, 2 days ago

 Description   

The value:

{ $and: [ [ null ], [ false ], [ 0 ] ] }

true
is wrong. Milos



 Comments   
Comment by Ravind Kumar (Inactive) [ 13/Jun/16 ]

Hello,

As stated in the documentation,

$and evaluates all other values as true, including non-zero numeric values and arrays.

From the example:

{ $and: [ [ null ], [ false ], [ 0 ] ] }	

The three values within the $and array are arrays themselves. While the content of each array would normally evaluate as false, $and evaluates the array itself and not the contents of the array. $and evaluates arrays as true. Therefore, the example can also be read as

{ $and: [ true, true, true ] }

I hope this answers your question.

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