Neo4j C# Driver: Method Not Found when calling ToListAsync()

43 Views Asked by At

I am using neo4j C# driver version 5.14.0 and I am getting a Method Not Found exception when executing the following code

await session.ExecuteWriteAsync(async tx =>
{
    var updateCypher = @"
        unwind $itemsArr as war
        merge (w:NodeA {uuid:war.Uuid})
        on match set w.durationmins=war.DurationMins,w.lastseen=0,w.new=null
        on create set w.durationmins=war.DurationMins,w.subtype=war.SubType,w.mtype=war.Type,w.new='Y',w.lastseen=0
        return count(w) as cnt
    ";

    await tx.RunAsync(updateCypher, new { itemsArr = myItems });
    
    var uniqueIdCursor = await tx.RunAsync("match (w:NodeA) where not  (w)-[]-(:NodeB) and w.new = 'Y' return w.uuid");  

    var uniqueIdList = await uniqueIdCursor.ToListAsync();
    var uniqueIds = uniqueIdList.Select(x => x["w.uuid"].As<string>()).ToList();
    return uniqueIds
}

Exception: System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task1<System.Collections.Generic.List1<Neo4j.Driver.IRecord>> Neo4j.Driver.ResultCursorExtensions.ToListAsync(Neo4j.Driver.IResultCursor)'.

However, if I replace the last three lines of code with this I get no error:

List<string> uniqueIds = [];

while (await uniqueIdCursor.FetchAsync())
{
    var uniqueId = uniqueIdCursor.Current[0].ToString();
    uniqueIds.Add(uniqueId);
}

return uniqueIds;

I do not understand why in this scenario ToListAsync() is not available to IResultCursor

0

There are 0 best solutions below