How many sessions can have one drive

I have a node js project where one of DBs is neo4j. Currently there are three main function I do with neo4j create, update, delete. Since there are cases when I create 1 Million nodes or relationships I need to send them by chunks. So long I was creating and closing driver and session every time I was doing transaction. Now I want to understand when to open driver and when open session? When should I use reactive sessions? So far I found out , that dirve.close() should be implemented right before my server closes.
Form github I didn't understood what they mean by Create a reactive session to run Cypher statements in. I assume I will write cypher code anyway what is the difference reactive makse ?

Reactive is an more efficient use of resources esp. if you have many clients reading the data.

For you it might not make so much of a difference as the node API is already working with promises.

Yes you should only create the driver once and then close it when your app closes.

But you should create a new session for each new batch/block.
You can still attach multiple transactions to that session if you need to do multiple operations.

1 Like