Learn R Programming

mongopipe (version 0.1.2)

condition: Conditional expression ($cond)

Description

Evaluates a boolean expression to return one of the two specified return expressions.

Usage

condition(test, yes, no)

Value

Return a list for using in mongopipe.

Arguments

test

Expression which returns a boolean value.

yes

Return this if the test returns true.

no

Return this if the test returns false.

Examples

Run this code
if (FALSE) {
cond <- condition(test = list("$isArray"="$chart"),
                  yes = list("$size"="$chart"),
                  no = 0)
jsonlite::toJSON(cond)
}

Run the code above in your browser using DataLab