webjay
webjay

Reputation: 5488

Choose properties to be COLLECTed

How can I choose which properties to be collected in a Cypher COLLECT statement?

I can do COLLECT([profile.name, profile.email]) but then I don't get the properties names.

Say I have ProfileA which is connected to several ProfileB's, I'd like to have returned ProfileA and a collection of ProfileB's where ProfileA-->ProfileB, but only ProfileB.name and ProfileB.email.

Upvotes: 2

Views: 70

Answers (1)

Eve Freeman
Eve Freeman

Reputation: 33145

At the moment there's no support for literal maps in collections, so we can't build a collection of maps, which it sounds like you want to be able to do.

Your idea of passing a collection to collect should work, and you'll get a collection of collections where the name is always first and the email is always last.

Another option is to do collect(profile.name) as names, collect(profile.email) as emails and have two collections.

Or, you could just have the full nodes. Sorry that there's not a better way (AFAIK)!

Upvotes: 4

Related Questions