Cypher match and return distinct nodes according to a parameter

I have a simple query like this :

MATCH (n:application) RETURN n

and with a parameter 'app' in the node, so with this query for each application i have like 2 nodes with different ids but with the same parameter 'app'.

What i want is to get all applications nodes with distinct on 'app' param, in the case that i have two nodes i want one of them not the 2 returned.

Thank you,

you can try the following. It will query for all Application nodes, groups them by values, then return only one node for each distinct value of

MATCH (n:application)
with, collect(n) as nodes
return, nodes[0]