Skip to content

Neo4j driver #835

Closed Answered by AndyHeap-NeoTech
killJoy-03 asked this question in Q&A
Jan 17, 2025 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Hi KillJoy, apologies for the slow reply. I missed the notification of your message in my inbox.

With the result cursor object you can 'fetch' records as they become available, allowing you to process them as they arrive rather than building a collection in memory and taking up that space. Under the hood the ToListAsync method is doing exactly this, but fetching all of the records into memory in one go.

An example of how to do this would be:

    using var session = Driver.Session();
    return session.ExecuteRead(
            tx =>
            {
                var result = tx.Run("MATCH (a:Person) RETURN a.name ORDER BY a.name");

                //do something with each record as it is …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@killJoy-03
Comment options

Answer selected by killJoy-03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants