Mohamed Thasin ah
Mohamed Thasin ah

Reputation: 11192

How to create node property key with whitespace in neo4j?

I'm new to neo4j, I want to create a property where key is not a single element. I need to create with space. How to do this in neo4j?

For Example,

CREATE (matrix:Movie {title: "The Matrix"})

I can create a property called title. But I want to do something like below,

CREATE (matrix:Movie {"new title": "The Matrix"})

It throws me following error,

Neo.ClientError.Statement.SyntaxError: Invalid input '"': expected whitespace, a property key name, '}', an identifier or UnsignedDecimalInteger (line 1, column 22 (offset: 21)) "MERGE (matrix:Movie {"new title": "The Matrix"})"

Basically I thought, "" will help me to solve this problem. But it's working only for property value not for property key. How to solve this problem. Thanks in Advance.

Upvotes: 1

Views: 1765

Answers (1)

InverseFalcon
InverseFalcon

Reputation: 30407

You can use backticks ` around your property name to accommodate spaces.

For example,

CREATE (matrix:Movie {`new title`: "The Matrix"})

Upvotes: 1

Related Questions