cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Want to know the difference between apoc.do.case and apoc.do.when

Hello team,

I want to know the difference between apoc.do.case and apoc.do.when APOC's.
Also let me know which of the above is used in which scenarios.

Best Regards
Akshat

2 REPLIES 2

apoc.do.when() is similar to an if/else conditional based on a single evaluated boolean expression, so there can be only two outcomes, with the ability to supply a Cypher query to execute in each of those two cases.

apoc.do.case() is more similar to a case statement, in that you can have several boolean conditions to evaluate, executing the Cypher associated with only the first one that evaluates to true (or falling back on the else conditional if none of the evaluated conditions is true).

bmalbusca
Node Clone

There is also documentation about it here