Works for me, if you created both user nodes with initial properties

create (:User {id:1,follow:0, followed:0})

otherwise you have to adapt for null values:

*MATCH (a:User), (b:User)*
*WHERE a.id <http://a.id/> = 1 AND b.id <http://b.id/> = 2*
*merge (a)-[r:FOLLOW]->(b) ON CREATE SET a.follow = coalesce(a.follow,0)+1,
b.followed = **coalesce(**b.followed,0)+1*
*RETURN r*



On Mon, Jan 27, 2014 at 11:53 AM, ivan limonov <[email protected]> wrote:

> Hello
> I run the following command in neo4j using Cypher:
> *MATCH (a:User), (b:User)*
> *WHERE a.id <http://a.id> = 1 AND b.id <http://b.id> = 2*
> *merge (a)-[r:FOLLOW]->(b) ON CREATE SET a.follow = a.follow+1, b.followed
> = b.followed+1*
> *RETURN r*
> Is it possible that the counter follow or followed is not updated?
> I mean partial update.
> Do I need to resort on such a query to transactions that would avoid a
> partial update?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to