Function ifnull()
judges if a value is null and returns an alternative value if true, or returns the original value if false.
When the two input aliases are of different data structures, data conversion might be triggered to guarantee a consistent data type in the final column.
Arguments:
- Any value <any>
- Alternative value <any>
Returns:
- Result <any>
If the value and the alternative value are non-homologous, Cartesian Product will be applied when the function is called in a WITH clause, or aliases will be trimmed when called in a RETURN clause.
Comman Usage
Example: Find two products P001, P002 and two cards CA001 and CA002, return the product name or 0. Known that property @card.name does not exist
find().nodes({_id in ["P001", "P002", "CA001", "CA002"]}) as n
return ifnull(n.name, 0)