docs: fix TypeScript client examples that call missing methods

Merged
AN
6d ago
+85-32

Several JavaScript examples call methods the falkordb client doesn't have, so copying them fails. This fixes them using the API of the current release (falkordb 6.9.2); they keep working in the upcoming 7.0.

PageWasNow
graph.copyclient.copyGraph('A', 'Z') (doesn't exist)graphA.copy('Z')
graph.constraint-createclient.createConstraint('g', 'UNIQUE', 'NODE', 'Person', [...]) (doesn't exist)graph.constraintCreate(ConstraintType.UNIQUE, EntityType.NODE, 'Person', 'first_name', 'last_name'), with the enums imported from falkordb
graph.constraint-create (listing)console.log(result)console.log(result.data)
graph.constraint-dropclient.dropConstraint(...) (doesn't exist)graph.constraintDrop(ConstraintType.UNIQUE, EntityType.NODE, ...)
graph.memorymemoryUsage({ samples: 500 })memoryUsage({ SAMPLES: 500 }), the option's actual name
Home pageconsole.log(result) // Valentino Rossiconsole.log(result.data) // [ { 'r.name': 'Valentino Rossi' } ]

constraintCreate and constraintDrop resolve without a value, so their examples no longer log a result.

.wordlist.txt gets constraintCreate, constraintDrop, ConstraintType and EntityType. The spellcheck reads some code blocks on the constraint page as prose, the same way it already handled createConstraint and copyGraph. The file was also missing its final newline.

Verification

  • Snippets: every changed snippet was run against a FalkorDB server with falkordb@6.9.2 from npm. Copy, both constraint types, listing, drop, memory usage and the quick-start query all work, and their output matches the comments.
  • Pending client fix: memoryUsage({ SAMPLES }) hits a client bug: it sends the count without the SAMPLES keyword, and the server rejects it. The fix is FalkorDB/falkordb-ts#696. The docs example already uses the right option.
  • MDX: node scripts/check_mdx.mjs reports 196 files, 0 with syntax errors.
  • Spellcheck: pyspelling -c .spellcheck.yml -n Markdown passes for the changed pages.

Not changed here

  • Other languages: the Python, Java and Rust examples on the constraint pages also call methods those clients don't have (client.create_constraint, graph.createConstraint, ...). They need checking against each client.
  • v7-only changes: a separate PR updates the TypeScript examples for falkordb 7.0 (explain/profile return a parsed plan, copy returns the new graph, constraint helpers), to merge when 7.0 is published.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated JavaScript examples for creating, listing, and dropping constraints, copying graphs, and resetting the slow log.
    • Clarified that constraint helpers require FalkorDB 7.0 or later and documented alternatives for earlier versions.
    • Corrected memory-sampling syntax and noted that the SAMPLES option requires FalkorDB 7.0 or later.
    • Improved examples for displaying query results, explain plans, and profile operation details.
    • Documented JavaScript integer precision limits and how to read query-result integers as exact bigint values.
    • Added a link to the v6-to-v7 migration guide and highlighted key breaking-change topics.