Create Auto Incremented attribute in Apache AGE

How to Create an Auto Incremented Attribute in Apache AGE

Apache AGE allows you to create an auto incremented (serial) attribute with the AUTOINCREMENT keyword.

For example, to add an auto incremented order_id attribute to the following query:

SELECT *
FROM cypher('online_orders', $$
    CREATE(:User{name:"user1" ,email : "test@test.com" , phone:"123456" });
$$) AS (result agtype)

you can use the following syntax:

SELECT *
FROM cypher('online_orders', $$
    CREATE(:User{name:"user1" ,email : "test@test.com" , phone:"123456", order_id: AUTOINCREMENT});
$$) AS (result agtype)

The correct syntax to create an auto incremented attribute in Apache AGE is:

SELECT *
FROM cypher('online_orders', $$
    CREATE(:User{name:"user1" ,email : "test@test.com" , phone:"123456", order_id: AUTOINCREMENT});
$$) AS (result agtype)