This works and returns the local variable:
const result = await session.writeTransaction(tx => {
return tx.run(
'UNWIND $batch AS row\
WITH "HELLO WORLD" AS temp\
MERGE (block:Block{blockNumber: 1})\
RETURN temp\',
rows
)
});
console.log(result.records[0]);
However, this returns undefined:
const result = await session.writeTransaction(tx => {
return tx.run(
'UNWIND $batch AS row\
WITH "HELLO WORLD" AS temp\
MERGE (block:Block{blockNumber: row.block.blockNumber, createdAt: row.block.createdAt})\
RETURN temp\',
rows
)
});
console.log(result.records[0]);
Any ideas? I want to be able to return some locally defined variables (simplified in this example).