$and/$or/$not

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Conditional and logical expressions

What it does

Combines or negates boolean expressions.

Syntax

{$and: [expression, ...]}

Use case

Compute compound conditions.

$and/$or/$not: practical example
{ $project: { eligible: { $and: [{ $gte: ["$age", 18] }, { $eq: ["$verified", true] }] } } }
💡 Explanation Combines or negates boolean expressions. When to use it Compute compound conditions.
Key Takeaways
  • Combines or negates boolean expressions.
  • Typical use: Compute compound conditions.