@@ -37,7 +37,7 @@ const parseRoutingTable = (routingTableStr: string) => {
37
37
return undefined ;
38
38
}
39
39
return {
40
- database : matched [ 1 ] === 'default database' ? null : matched [ 0 ] ,
40
+ database : matched [ 1 ] === 'default database' ? null : matched [ 1 ] ,
41
41
expirationTime : parseInt ( matched [ 2 ] , 10 ) ,
42
42
currentTime : parseInt ( matched [ 3 ] , 10 ) ,
43
43
routers : csv ( matched [ 4 ] ) ,
@@ -66,7 +66,13 @@ export const CypherFactory: FactoryProvider<Connection> = {
66
66
logger : ILogger ,
67
67
driverLogger : ILogger ,
68
68
) => {
69
- const { url, username, password, database, driverConfig } = config . neo4j ;
69
+ const {
70
+ url,
71
+ username,
72
+ password,
73
+ database : databaseNameFromConfig ,
74
+ driverConfig,
75
+ } = config . neo4j ;
70
76
71
77
const driverLoggerAdapter : LoggerFunction = ( neoLevel , message ) => {
72
78
const level =
@@ -148,8 +154,13 @@ export const CypherFactory: FactoryProvider<Connection> = {
148
154
if ( ! this . open ) {
149
155
return null ;
150
156
}
157
+
158
+ // Assume the default name to workaround routing table cache bug.
159
+ // https://github.com/neo4j/neo4j-javascript-driver/issues/1138
160
+ const resolvedDatabaseName = databaseNameFromConfig || 'neo4j' ;
161
+
151
162
const session = this . driver . session ( {
152
- database,
163
+ database : resolvedDatabaseName ,
153
164
} ) ;
154
165
155
166
session . run = wrapQueryRun ( session , logger , parameterTransformer ) ;
0 commit comments