Can we Run cypher query after one hour of its creation using triggers and apoc


(Mishaparnami1) #1

I want to increase the post_views property of a node after one hour of its creation automatically.
Example-

  1. Create post
    Create (p:Post{uuid:"123",post_title:"test",post_views:0,created_at:timestamp()})
  2. Update the post_views to 50 after one hour.
    match (p:Post{uuid:"123"}) set p.post_views=abs(p.post_views+50)

My question is how I can automate this so that whenever a post is created in the database with Post Label after one hour of its creation automatically post_views is increased by 50.


(Paul Thomas) #2

Haven't used apoc.periodic.repeat myself before but looks ...

https://stackoverflow.com/questions/37505994/neo4j-query-run-at-specific-time
https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_further_functions

like it should do the job!


(Mishaparnami1) #3

@paul.thomas Thanks for the answer these links really helped me