Advanced logic

Enabling Advanced logic allows you to write custom boolean expressions using MongoDB’s query and projection operatorsarrow-up-right, giving you full flexibility over conditional rendering in your flow.

Instead of using a visual logic builder, you write logic directly in JSON format. Each answer variable maps to a field, and standard MongoDB query operators evaluate those fields.

Why JSON, not Drag-and-Drop?

While we may support a visual builder in the future, the JSON-based syntax is:

  • Powerful and expressive

  • Lightweight and easy to copy/paste

  • Flexible enough for most complex logic needs

Common patterns

Both conditions must be true$and

Enable an item only if both conditions are satisfied:

  • distance_to_office is less than or equal to 75

  • is_qualified is true

{
  "$and": [
    {
      "distance_to_office": {
        "$lte": 75
      }
    },
    {
      "is_qualified": true
    }
  ]
}

Read more about $andarrow-up-right.

At least one condition is true - $or

Enable an item if either of the following is true:

  • is_parent is true

  • has_parent_consent is true

Read more about $orarrow-up-right.

Answer is one of several values$in

Check if an answer matches any value from a list.

Enable if country is CA, MX, or US:

Read more about $inarrow-up-right.

Answer is not in a list of values — $nin

Check that an answer does not match any value from a list.

Enable if state is not NY or PA:

Read more about $ninarrow-up-right.

Answer is defined$exists

Enable if a variable has any value (even false):

This mirrors the behavior of the Is defined simple logic operator.

Read more about $existsarrow-up-right.

Last updated

Was this helpful?