⚠️ This API is released as preview.
This function enables fetching only the first record in the Result. If any other record is present, it will be discarded and network optimization might be applied.
Examples:
// using in the execute query
const maybeFirstRecord = await driver.executeQuery('MATCH (p:Person{ age: $age }) RETURN p.name as name', { age: 25 }, {
database: 'neo4j,
resultTransformer: neo4j.resultTransformers.first()
})
// using in other a result
const maybeFirstRecord = await session.executeRead(tx => {
// do not `await` or `resolve` the result before send it to the transformer
const result = tx.run('MATCH (p:Person{ age: $age }) RETURN p.name as name', { age: 25 })
return neo4j.resultTransformers.first()(result)
})
⚠️ This API is released as preview. This function enables fetching only the first record in the Result. If any other record is present, it will be discarded and network optimization might be applied.
Examples:
⚠️ This API is released as preview.