Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AQL KEEP(): return object as is if null is supplied as second argument #7764

Open
Simran-B opened this issue Dec 13, 2018 · 0 comments
Open

AQL KEEP(): return object as is if null is supplied as second argument #7764

Simran-B opened this issue Dec 13, 2018 · 0 comments

Comments

@Simran-B
Copy link
Contributor

@Simran-B Simran-B commented Dec 13, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.