You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cypher are improving the notifications that are produced by query execution by making it configurable what level of notifications can be returned and adding additional information to notifications.
Usage:
```typescript
import neo4j from 'neo4j-driver'
// Configuring at the driver level
const driver = neo4j.driver(<ADDRESS>, <TOKEN>, {
notificationFilter: {
minimumSeverityLevel: neo4j.notificationFilterMinimumSeverityLevel.WARNING // or 'WARNING'
}
})
// Configuring a the session level
const session = driver.session({
database: 'neo4j',
notificationFilter: {
minimumSeverityLevel: neo4j.notificationFilterMinimumSeverityLevel.INFORMATION // or 'INFORMATION',
disabledCategories: [
neo4j.notificationFilterDisabledCategory.HINT, // or 'HINT',
neo4j.notificationFilterDisabledCategory.GENERIC // or 'GENERIC'
]
}
})
// Configuring using plain string.
const session = driver.session({
database: 'neo4j',
notificationFilter: {
minimumSeverityLevel: 'INFORMATION',
disabledCategories: [
'HINT',
'GENERIC'
]
}
})
const { summary } = await session.executeWrite(tx => tx.run(<QUERY>, <PARAMS>))
// Reading notifications
for (const notification of summary.notifications) {
switch(notification.severityLevel) {
case neo4j.notificationSeverityLevel.INFORMATION: // or simply 'INFORMATION'
console.info(`[${notification.category}] ${notification.title} - ${notification.description}`)
break
case neo4j.notificationSeverityLevel.WARNING: // or simply 'WARNING'
console.warn(`[${notification.category}]${notification.title} - ${notification.description}`)
break
case neo4j.notificationSeverityLevel.UNKNOWN: // or simply 'UNKNOWN'
default:
// the raw info came from the server could be found at notification.rawSeverityLevel
console.log(`[${notification.category}]${notification.title} - ${notification.description}`)
break
}
}
```
More details in the methods documentation and type signature.
0 commit comments