MATCH (b:Business {userId: 'ICzepCPHTDP75FS4QDoDzHCmdmy2'})
SET b.businessHours = [
{day: "Monday", from: "10 am", to: "8 pm"},
{day: "Tuesday", from: "10 am", to: "8 pm"},
{day: "Wednesday", from: "10 am", to: "8 pm"},
{day: "Thursday", from: "10 am", to: "8 pm"},
{day: "Friday", from: "10 am", to: "8 pm"},
{day: "Saturday", from: "10 am", to: "8 pm"},
{day: "Sunday", from: "10 am", to: "8 pm"}
]
RETURN b
You could create an Hours node with this properties and related them to your Business node.
As an alternative, you could use an apoc procedure to convert the array into a json escaped string so it can be stored in a property. This doesn’t make the data very accessible, as you would always need to use one of the other apoc.convert methods to decode the data.
The first approach is more compatible to a graph database. I don’t know what the rest of your data model looks like, but would a relational database be better, or a NoSql or document database?
can i use gds free version
This may help keep it simple, to store and to read :
WITH {businessHours:[
{day: "Monday", from: "10 am", to: "8 pm"},
{day: "Tuesday", from: "10 am", to: "8 pm"},
{day: "Wednesday", from: "10 am", to: "8 pm"},
{day: "Thursday", from: "10 am", to: "8 pm"},
{day: "Friday", from: "10 am", to: "8 pm"},
{day: "Saturday", from: "10 am", to: "8 pm"},
{day: "Sunday", from: "10 am", to: "8 pm"}
]} as inputMap
WITH apoc.convert.toJson(inputMap) as inputJsonString
CREATE (j:JsonRecord) set j.content = inputJsonString, j.id = 1
RETURN j
MATCH (j:JsonRecord) WHERE j.id = 1
WITH j.content as contentJsonString, apoc.convert.fromJsonMap(j.content) as contentMap
RETURN contentMap.businessHours