Search code examples
neo4jcypherneo4j-apocdollar-sign

Neo4j How to access a property in a map with key containing dollar sign $


I have a json in the following format:

{"_id":"someid123"
"role": "Customer",
"itemDate": {
"$date": 1579687615849
  }
}

I want to access the itemDate.$date to add it as a property of my node When I try:

call apoc.merge.node(["InteractionItem"], {id:item._id}, {date: item.itemDate.$date}) 
yield node as i_item return i_item

I get the following error:

Invalid input '$': expected an identifier

Please let me know if there is any solution for working with "$" dollar signs or a solution to clean the dollar signs off of a map.

Thanks.

P.S: I'm working with Neo4j 4.4.3


Solution

  • I was able to solve this using

    `
    such as:

    call apoc.merge.node(["InteractionItem"], {id:item._id}, {date: item.itemDate.`$date`}) 
    yield node as i_item return i_item