meerkat
meerkat

Reputation: 3003

Return multiple node properties under one alias

My part of query looks like:

RETURN user.username as createdBy

I want something like this:

RETURN (user.username, user.profilePicture) as createdBy

Where in result I will get createdBy as an object with properties username and profilePicture.

Upvotes: 0

Views: 531

Answers (1)

InverseFalcon
InverseFalcon

Reputation: 30397

If you're using Neo4j 3.1.x, you can use map projection to only return interested properties of a node:

RETURN user {.username, .profilePicture} as createdBy

If you're using 3.0.x, you can explicitly return a map with the properties you want:

RETURN {username:user.username, profilePicture:user.profilePicture} as createdBy

Upvotes: 1

Related Questions