From e0f134cb8ad37f11fb1fc3e38bfa375836dd419f Mon Sep 17 00:00:00 2001 From: Shahar Biron <38566538+shahar-biron@users.noreply.github.com> Date: Thu, 15 Oct 2026 13:00:40 +0300 Subject: [PATCH 1/2] fix: correct broken JS/Java/Rust code samples in quickstart docs - getting-started/index.mdx: - JavaScript: iterate result.data (query/roQuery return an object with headers/data, not an iterable) instead of result directly. - Java: use Record.getValue(...) instead of the non-existent Record.get(...). - Rust: remove invalid backslash-escaping of quotes inside raw string literals, use the synchronous client consistently (.execute().expect(...) instead of mixing in .await on a sync builder), and read columns via row.try_get(...) instead of nonexistent Row indexing (row["Alias"]). - index.mdx: - Rust: drain the async RowStream with next().await under futures::StreamExt instead of a plain for loop, which doesn't compile against a Stream. Also avoid erroring on first run by ignoring the delete-nonexistent-graph error. Co-Authored-By: Warp --- getting-started/index.mdx | 46 ++++++++++++++++++++++++--------------- index.mdx | 13 ++++++----- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/getting-started/index.mdx b/getting-started/index.mdx index 0a0aedb7..5dfbd766 100644 --- a/getting-started/index.mdx +++ b/getting-started/index.mdx @@ -239,12 +239,12 @@ System.out.println("Graph created successfully!"); ```rust Rust let create_query = r#" -CREATE (alice:User {id: 1, name: \"Alice\", email: \"alice@example.com\"}) -CREATE (bob:User {id: 2, name: \"Bob\", email: \"bob@example.com\"}) -CREATE (charlie:User {id: 3, name: \"Charlie\", email: \"charlie@example.com\"}) +CREATE (alice:User {id: 1, name: "Alice", email: "alice@example.com"}) +CREATE (bob:User {id: 2, name: "Bob", email: "bob@example.com"}) +CREATE (charlie:User {id: 3, name: "Charlie", email: "charlie@example.com"}) -CREATE (post1:Post {id: 101, content: \"Hello World!\", date: 1701388800}) -CREATE (post2:Post {id: 102, content: \"Graph Databases are awesome!\", date: 1701475200}) +CREATE (post1:Post {id: 101, content: "Hello World!", date: 1701388800}) +CREATE (post2:Post {id: 102, content: "Graph Databases are awesome!", date: 1701475200}) CREATE (alice)-[:FRIENDS_WITH {since: 1640995200}]->(bob) CREATE (bob)-[:FRIENDS_WITH {since: 1684108800}]->(charlie) @@ -252,7 +252,7 @@ CREATE (alice)-[:CREATED {time: 1701388800}]->(post1) CREATE (bob)-[:CREATED {time: 1701475200}]->(post2) "#; -graph.query(create_query).execute().await?; +graph.query(create_query).execute().expect("Failed to create graph"); println!("Graph created successfully!"); ``` @@ -285,7 +285,9 @@ RETURN friend.name AS Friend `; const result = await graph.roQuery(query); console.log("Alice's friends:"); -for (const record of result) { +// Query results are returned on the `data` array; each row is an object +// keyed by the RETURN aliases (here, `Friend`). +for (const record of result.data) { console.log(record["Friend"]); } ``` @@ -298,20 +300,23 @@ RETURN friend.name AS Friend ResultSet result = graph.readOnlyQuery(query); System.out.println("Alice's friends:"); for (Record record : result) { - System.out.println(record.get("Friend")); + // Record exposes values via getValue(...), not get(...) + System.out.println(record.getValue("Friend")); } ``` ```rust Rust let query = r#" -MATCH (alice:User {name: \"Alice\"})-[:FRIENDS_WITH]->(friend) +MATCH (alice:User {name: "Alice"})-[:FRIENDS_WITH]->(friend) RETURN friend.name AS Friend "#; -let result = graph.ro_query(query).execute().await?; +let result = graph.ro_query(query).execute().expect("Failed to run query"); println!("Alice's friends:"); -for record in result.data.by_ref() { - println!("{}", record["Friend"]); +for row in result.data { + let row = row.expect("row failed to parse"); + let friend: String = row.try_get("Friend").expect("Friend column"); + println!("{friend}"); } ``` @@ -342,7 +347,9 @@ RETURN post.content AS PostContent `; const result = await graph.roQuery(query); console.log("Posts created by Bob:"); -for (const record of result) { +// Query results are returned on the `data` array; each row is an object +// keyed by the RETURN aliases (here, `PostContent`). +for (const record of result.data) { console.log(record["PostContent"]); } ``` @@ -355,19 +362,22 @@ RETURN post.content AS PostContent ResultSet result = graph.readOnlyQuery(query); System.out.println("Posts created by Bob:"); for (Record record : result) { - System.out.println(record.get("PostContent")); + // Record exposes values via getValue(...), not get(...) + System.out.println(record.getValue("PostContent")); } ``` ```rust Rust let query = r#" -MATCH (bob:User {name: \"Bob\"})-[:CREATED]->(post:Post) +MATCH (bob:User {name: "Bob"})-[:CREATED]->(post:Post) RETURN post.content AS PostContent "#; -let result = graph.ro_query(query).execute().await?; +let result = graph.ro_query(query).execute().expect("Failed to run query"); println!("Posts created by Bob:"); -for record in result.data.by_ref() { - println!("{}", record["PostContent"]); +for row in result.data { + let row = row.expect("row failed to parse"); + let content: String = row.try_get("PostContent").expect("PostContent column"); + println!("{content}"); } ``` diff --git a/index.mdx b/index.mdx index 476a2fe6..036af512 100644 --- a/index.mdx +++ b/index.mdx @@ -186,6 +186,7 @@ public class FalkorDBExample { ```rust Rust use falkordb::{FalkorClientBuilder, FalkorConnectionInfo}; +use futures::StreamExt; #[tokio::main] async fn main() -> Result<(), Box> { @@ -203,7 +204,7 @@ async fn main() -> Result<(), Box> { let mut graph = client.select_graph("MotoGP"); // Clear out this graph in case you've run this script before. - graph.delete().await?; + let _ = graph.delete().await; graph .query( @@ -225,8 +226,10 @@ async fn main() -> Result<(), Box> { .execute() .await?; - for node in nodes.data.by_ref() { - println!("{:?}", node); + // `nodes.data` is a `RowStream` (a `futures::Stream`), not a synchronous + // `Iterator`, so draining it needs `.next().await` rather than a plain `for` loop. + while let Some(row) = nodes.data.next().await { + println!("{:?}", row?); } // Query how many riders represent team Ducati? @@ -235,8 +238,8 @@ async fn main() -> Result<(), Box> { .execute() .await?; - for node in nodes.data.by_ref() { - println!("{:?}", node); + while let Some(row) = nodes.data.next().await { + println!("{:?}", row?); } Ok(()) From 8a7d45a4b00281c320deabebfc12d96098326887 Mon Sep 17 00:00:00 2001 From: Shahar Biron <38566538+shahar-biron@users.noreply.github.com> Date: Thu, 15 Oct 2026 13:09:04 +0300 Subject: [PATCH 2/2] docs(spellcheck): add getValue to wordlist CI flagged getValue as an unknown word in the getting-started/index.mdx Java code sample comments added in the previous commit. Whitelisting it follows the existing convention used for readOnlyQuery, roQuery, selectGraph, etc. Co-Authored-By: Warp --- .wordlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.wordlist.txt b/.wordlist.txt index 1d620326..3397cc63 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -341,6 +341,7 @@ geospatial getConfig getMessage GETUSER +getValue getzep gg GitHub