Not returning NULL when no records are found while using apoc.do.when

No changes no records. I believe the double quotes make it an exact match

Ah, so, did you try to test without? :slight_smile:

yes it works when I search for something that exists but won't work when I search for something that doesn't exists

It makes sense no? :smile:

Try:

RETURN coalesce(collect(node.car_type), []) AS test, node

No still doesn't work. I get why it doesn't work. I was hoping to get more than just empty square brackets in the response so that I know the reason is that there was actually no results from what I am searching.
I guess there is really no work around this.

If the thing you are searching doesn't not exist, the YIELD node will return nothing, that's why you must ass something at the end of your list in coalesce to make sure to return something :slight_smile:

1 Like