neo4j-labs / neo4rs

Neo4j driver for rust

Home Page:https://docs.rs/neo4rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apoc generated uuid not returning properly

lucasfelber opened this issue · comments

I set up the automatic uuid generation with apoc-extended when a node is created like so:
https://neo4j.com/labs/apoc/5/graph-updates/uuid/#automatic-uuids
But when I get the result back the uuid property is not there.

Here is the setup in the system database:

let systemdb_config = ConfigBuilder::default()
    .uri(&database_url)
    .db("system")
    .user(&database_user)
    .password(&database_password)
    .fetch_size(500)
    .max_connections(10)
    .build()
    .unwrap();

let systemdb = Arc::new(Graph::connect(systemdb_config).await.unwrap());
systemdb.run(query("CALL apoc.uuid.setup('user', 'neo4j', {addToExistingNodes: false})")).await.unwrap();

And this would cause an issue:

let database_config = ConfigBuilder::default()
    .uri(&database_url)
    .user(&database_user)
    .password(&database_password)
    .db("neo4j")
    .fetch_size(500)
    .max_connections(10)
    .build()
    .unwrap();

let graph = Arc::new(Graph::connect(database_config).await.unwrap());

let mut result = graph.execute(
    query("CREATE (user:user {name: $name}) RETURN user")
    .param("name", "Bob")
).await.unwrap();

while let Ok(Some(row)) = result.next().await {
    let node: Node = row.get("user").unwrap();
    let uuid: String = node.get("uuid").unwrap();
}

The result does not have the property uuid, even though it is present in the database.

Is this the intended behavior?

Can you please re-open the issue on the apoc repo? https://github.com/neo4j-contrib/neo4j-apoc-procedures?

In short the uuid is added in the tx-event handler which runs after the data to be sent to the client has been fetched by the cypher runtime.

You can probably re-fetch the node by its elementId().