@@ -132,6 +132,41 @@ class SessionConfig {
132
132
/**
133
133
* The database this session will operate on.
134
134
*
135
+ * This option has no explicit value by default, but it is recommended to set
136
+ * one if the target database is known in advance. This has the benefit of
137
+ * ensuring a consistent target database name throughout the session in a
138
+ * straightforward way and potentially simplifies driver logic as well as
139
+ * reduces network communication resulting in better performance.
140
+ *
141
+ * When no explicit name is set, the driver behavior depends on the connection
142
+ * URI scheme supplied to the driver on instantiation and Bolt protocol
143
+ * version.
144
+ *
145
+ * Specifically, the following applies:
146
+ *
147
+ * - **bolt schemes** - queries are dispatched to the server for execution
148
+ * without explicit database name supplied, meaning that the target database
149
+ * name for query execution is determined by the server. It is important to
150
+ * note that the target database may change (even within the same session),
151
+ * for instance if the user's home database is changed on the server.
152
+ *
153
+ * - **neo4j schemes** - providing that Bolt protocol version 4.4, which was
154
+ * introduced with Neo4j server 4.4, or above is available, the driver
155
+ * fetches the user's home database name from the server on first query
156
+ * execution within the session and uses the fetched database name
157
+ * explicitly for all queries executed within the session. This ensures that
158
+ * the database name remains consistent within the given session. For
159
+ * instance, if the user's home database name is 'movies' and the server
160
+ * supplies it to the driver upon database name fetching for the session,
161
+ * all queries within that session are executed with the explicit database
162
+ * name 'movies' supplied. Any change to the user’s home database is
163
+ * reflected only in sessions created after such change takes effect. This
164
+ * behavior requires additional network communication. In clustered
165
+ * environments, it is strongly recommended to avoid a single point of
166
+ * failure. For instance, by ensuring that the connection URI resolves to
167
+ * multiple endpoints. For older Bolt protocol versions the behavior is the
168
+ * same as described for the **bolt schemes** above.
169
+ *
135
170
* @type {string|undefined }
136
171
*/
137
172
this . database = ''
@@ -589,6 +624,5 @@ function createHostNameResolver (config: any): ConfiguredCustomResolver {
589
624
return new ConfiguredCustomResolver ( config . resolver )
590
625
}
591
626
592
- export { Driver , READ , WRITE }
593
- export type { SessionConfig }
627
+ export { Driver , READ , WRITE , SessionConfig }
594
628
export default Driver
0 commit comments