Most efficient way check for value in an array?

whats the most efficient way in Cypher to check for a value in an array? For example, if i wanted to check an array property of numbers [5,6,7], I could use the $in operator. but is there a better/recommended way ?

That should work in most cases. If you have a much larger set of values, then it might be worth using APOC Procedures, as you can use apoc.coll.contains() or apoc.coll.containsAll() which use a set under the hood.

1 Like

Cypher itself also got better under the hood. It creates a companion set under the hood while checking iteratively for the first time.

The only thing that doesn't work with schema indexes is to lookup values inside of the array from the index.

That's something that works with explicit indexes.