You may want to write a query like KEEP(doc, @attr) so that you can define which attributes to return via a bind parameter. If you want this to be optional, then you need a ternary operator at the moment:
RETURN IS_NULL(@attr) ? doc : KEEP(doc, @attr)
KEEP() could be changed to return all attributes if the second parameter is null:
RETURN KEEP(doc, @attr) with { "attr": null }
I don't know if [null], [] or falsey values should also return doc unchanged. [] should not IMO, because it's basically an explicit list of zero attributes to keep - what is the purpose though?
Not sure if it's worth to change the behavior as there is a workaround available.
This was originally requested by user Trung in the community Slack.
The text was updated successfully, but these errors were encountered:
You may want to write a query like
KEEP(doc, @attr)
so that you can define which attributes to return via a bind parameter. If you want this to be optional, then you need a ternary operator at the moment:RETURN IS_NULL(@attr) ? doc : KEEP(doc, @attr)
KEEP()
could be changed to return all attributes if the second parameter is null:RETURN KEEP(doc, @attr)
with{ "attr": null }
I don't know if
[null]
,[]
or falsey values should also return doc unchanged.[]
should not IMO, because it's basically an explicit list of zero attributes to keep - what is the purpose though?Not sure if it's worth to change the behavior as there is a workaround available.
This was originally requested by user Trung in the community Slack.
The text was updated successfully, but these errors were encountered: