Company
Date Published
Author
David Allen
Word count
1314
Language
English
Hacker News points
None

Summary

The Neo4j driver best practices emphasize the importance of using secure connections, such as `neo4j+s://`, which provides certificate validation and ensures a secure connection. Using very recent versions of Neo4j drivers is also crucial, particularly for Neo4j Aura environments. It's essential to verify connectivity before issuing queries and create one driver instance once and hold onto it. Explicit transaction functions are recommended over auto-commit transactions, as they provide better control over commit behavior and allow for more efficient query execution. Query parameters should be used whenever possible to pass variables into Cypher queries, avoiding string concatenation. Processing database results within the transaction function is also important to avoid issues with result objects being available outside their scope. Bookmarking and causal consistency are key concepts in Neo4j drivers, allowing for reads of own writes and ensuring consistent reads across cluster members. By following these best practices, graph code can be made safer, more secure, more performant, and more portable between different graph environments.