How can I provide a default value if a field is ONLY null? #2380
Unanswered
bitwizeshift
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This seems like a basic question, but I can't seem to find a working solution. A search through the existing Q&A didn't yield the same question, so please excuse me if it's been asked before.
I have a document that looks like:
I want to select the
.some-node.enabled
and, if it's not specified (i.e.null
) it will default totrue
.The problem is that the expression
.some-node.enabled // true
yieldstrue
100% of the time because, for some reason,//
coalesces tofalse
ornull
to the second value. What I'm wanting is something that does true coalescing of onlynull
values.Some sources are suggesting instead using an
if
statement, but any time I attempt something like:It fails with an error like:
I'm sure I'm overlooking something simple; this must be supported, right?
Beta Was this translation helpful? Give feedback.
All reactions