1- # MongoDB Node.js Driver - Experimental Featuress
1+ # MongoDB Node.js Driver - Experimental Features
22
3- This report documents all experimental features in the MongoDB Node.js Driver version 7.1.0. The driver contains ** 31 experimental annotations** across 9 major feature categories. These features are marked as experimental because they may undergo breaking changes in future releases, even in minor or patch versions.
3+ This report documents all experimental features in the MongoDB Node.js Driver. The driver contains ** 34 experimental annotations** across 10 major feature categories. These features are marked as experimental because they may undergo breaking changes in future releases, even in minor or patch versions.
44
55---
66
77## Summary
88
99| Feature | Description | Introduced in | Status |
1010| ---------| -------------| ---------------| --------|
11- | [ Explicit Resource Management] ( #explicit-resource-management ) | Automatic cleanup using ` Symbol.asyncDispose ` | v6.9.0 | ⚠️ Experimental |
11+ | [ Runtime Adapters] ( #runtime-adapters ) | Custom runtime module implementations | v7.2.0 | ⚠️ Experimental |
12+ | [ Queryable Encryption Text Search] ( #queryable-encryption-text-search ) | Text search on encrypted fields | v6.19.0 | ⚠️ Public Technical Preview |
1213| [ AbortSignal Support] ( #abortsignal-support ) | Cancel operations using ` AbortController ` | v6.13.0 | ⚠️ Experimental |
13- | [ Timeout Management] ( #timeout-management ) | Control operation timeouts with ` timeoutMS ` | v6.6.0 | ⚠️ Experimental |
1414| [ Cursor Timeout Modes] ( #cursor-timeout-modes ) | Configure how timeouts apply to cursors | v6.11.0 | ⚠️ Experimental |
15- | [ Strict TypeScript Types] ( #strict-typescript-types ) | Enhanced type safety for filters and updates | v5.0.0 | ⚠️ Experimental |
15+ | [ Explicit Resource Management] ( #explicit-resource-management ) | Automatic cleanup using ` Symbol.asyncDispose ` | v6.9.0 | ⚠️ Experimental |
16+ | [ GridFS Timeout Support] ( #gridfs-timeout-support ) | Timeout options for GridFS streams | v6.6.0 | ⚠️ Experimental |
17+ | [ Timeout Management] ( #timeout-management ) | Control operation timeouts with ` timeoutMS ` | v6.6.0 | ⚠️ Experimental |
1618| [ Client-Side Encryption Features] ( #client-side-encryption-features ) | Custom key material and rewrap APIs | v6.0.0 | ⚠️ Experimental |
17- | [ Queryable Encryption Text Search ] ( #queryable-encryption-text-search ) | Text search on encrypted fields | v6.19 .0 | ⚠️ Public Technical Preview |
19+ | [ Strict TypeScript Types ] ( #strict-typescript-types ) | Enhanced type safety for filters and updates | v5.0 .0 | ⚠️ Experimental |
1820| [ Encrypted Fields] ( #encrypted-fields ) | Schema for encrypted collections | v4.6.0 | ⚠️ Experimental |
19- | [ GridFS Timeout Support] ( #gridfs-timeout-support ) | Timeout options for GridFS streams | v6.6.0 | ⚠️ Experimental |
2021
2122---
2223
@@ -29,10 +30,10 @@ This report documents all experimental features in the MongoDB Node.js Driver ve
2930** Description** : Native support for JavaScript's explicit resource management using ` Symbol.asyncDispose ` . This feature enables automatic cleanup of resources using the ` await using ` syntax.
3031
3132** Available On** :
32- - ` MongoClient ` - [ src/mongo_client.ts:466 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/mongo_client.ts#L466 )
33- - ` ClientSession ` - [ src/sessions.ts:293 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/sessions.ts#L293 )
34- - ` ChangeStream ` - [ src/change_stream.ts:576 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/change_stream.ts#L576 )
35- - All cursor types (` AbstractCursor ` , ` FindCursor ` , ` AggregationCursor ` , etc.) - [ src/cursor/abstract_cursor.ts:433 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/cursor/abstract_cursor.ts#L433 )
33+ - ` MongoClient ` - [ src/mongo_client.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/mongo_client.ts )
34+ - ` ClientSession ` - [ src/sessions.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/sessions.ts )
35+ - ` ChangeStream ` - [ src/change_stream.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/change_stream.ts )
36+ - All cursor types (` AbstractCursor ` , ` FindCursor ` , ` AggregationCursor ` , etc.) - [ src/cursor/abstract_cursor.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/cursor/abstract_cursor.ts )
3637
3738** Example** :
3839``` typescript
@@ -55,7 +56,7 @@ await using session = client.startSession();
5556** Status** : ⚠️ Experimental
5657
5758** Type** : ` Abortable `
58- ** Source** : [ src/mongo_types.ts:488 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/mongo_types.ts#L488 )
59+ ** Source** : [ src/mongo_types.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/mongo_types.ts )
5960
6061** Description** : Allows using ` AbortController ` to abort asynchronous operations. The ` signal.reason ` value is used as the error thrown.
6162
@@ -84,17 +85,17 @@ If an abort signal aborts an operation while the driver is writing to the underl
8485** Description** : Specifies the time (in milliseconds) an operation will run until it throws a timeout error.
8586
8687** Available On** :
87- - ` CommandOperationOptions ` - [ src/db.ts:97 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/db.ts#L97 )
88- - ` ClientSessionOptions ` - [ src/sessions.ts:141 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/sessions.ts#L141 )
89- - ` ClientSessionStartOptions.defaultTimeoutMS ` - [ src/sessions.ts:63 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/sessions.ts#L63 )
90- - ` ClientEncryptionOptions ` - [ src/client-side-encryption/client_encryption.ts:942 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/client-side-encryption/client_encryption.ts#L942 )
91- - ` MongoClientOptions ` - [ src/mongo_client.ts:145 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/mongo_client.ts#L145 )
92- - ` RunCommandOptions ` - [ src/operations/run_command.ts:19 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/operations/run_command.ts#L19 )
93- - ` RunCursorCommandOptions ` - [ src/cursor/run_command_cursor.ts:23 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/cursor/run_command_cursor.ts#L23 )
94- - ` CollectionOptions ` - [ src/collection.ts:123 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/collection.ts#L123 )
95- - ` OperationOptions ` - [ src/operations/operation.ts:42 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/operations/operation.ts#L42 )
96- - ` GridFSBucketReadStreamOptions ` - [ src/gridfs/index.ts:42 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/gridfs/index.ts#L42 )
97- - ` GridFSBucketWriteStreamOptions ` - [ src/gridfs/upload.ts:36 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/gridfs/upload.ts#L36 )
88+ - ` CommandOperationOptions ` - [ src/db.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/db.ts )
89+ - ` ClientSessionOptions ` - [ src/sessions.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/sessions.ts )
90+ - ` ClientSessionStartOptions.defaultTimeoutMS ` - [ src/sessions.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/sessions.ts )
91+ - ` ClientEncryptionOptions ` - [ src/client-side-encryption/client_encryption.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/client-side-encryption/client_encryption.ts )
92+ - ` MongoClientOptions ` - [ src/mongo_client.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/mongo_client.ts )
93+ - ` RunCommandOptions ` - [ src/operations/run_command.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/operations/run_command.ts )
94+ - ` RunCursorCommandOptions ` - [ src/cursor/run_command_cursor.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/cursor/run_command_cursor.ts )
95+ - ` CollectionOptions ` - [ src/collection.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/collection.ts )
96+ - ` OperationOptions ` - [ src/operations/operation.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/operations/operation.ts )
97+ - ` GridFSBucketReadStreamOptions ` - [ src/gridfs/index.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/gridfs/index.ts )
98+ - ` GridFSBucketWriteStreamOptions ` - [ src/gridfs/upload.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/gridfs/upload.ts )
9899- Various database and collection operation options
99100
100101** Example** :
@@ -117,10 +118,10 @@ const session = client.startSession({ timeoutMS: 30000 });
117118
118119** Type** : ` CursorTimeoutMode `
119120** Source** :
120- - Constant definition - [ src/cursor/abstract_cursor.ts:70 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/cursor/abstract_cursor.ts#L70 )
121- - Type definition - [ src/cursor/abstract_cursor.ts:104 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/cursor/abstract_cursor.ts#L104 )
122- - Option in ` AbstractCursorOptions ` - [ src/cursor/abstract_cursor.ts:155 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/cursor/abstract_cursor.ts#L155 )
123- - Option in ` RunCursorCommandOptions ` - [ src/cursor/run_command_cursor.ts:31 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/cursor/run_command_cursor.ts#L31 )
121+ - Constant definition - [ src/cursor/abstract_cursor.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/cursor/abstract_cursor.ts )
122+ - Type definition - [ src/cursor/abstract_cursor.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/cursor/abstract_cursor.ts )
123+ - Option in ` AbstractCursorOptions ` - [ src/cursor/abstract_cursor.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/cursor/abstract_cursor.ts )
124+ - Option in ` RunCursorCommandOptions ` - [ src/cursor/run_command_cursor.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/cursor/run_command_cursor.ts )
124125
125126** Values** :
126127- ` 'cursorLifetime' ` - Timeout applies to the entire cursor lifetime
@@ -162,17 +163,17 @@ const docs = await cursor2.toArray(); // Must complete in 1000ms total
162163** Types** :
163164
164165#### ` StrictFilter<TSchema> `
165- ** Source** : [ src/mongo_types.ts:622 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/mongo_types.ts#L622 )
166+ ** Source** : [ src/mongo_types.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/mongo_types.ts )
166167
167168Provides strict type checking for filter predicates with proper nested path support.
168169
169170#### ` StrictMatchKeysAndValues<TSchema> `
170- ** Source** : [ src/mongo_types.ts:664 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/mongo_types.ts#L664 )
171+ ** Source** : [ src/mongo_types.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/mongo_types.ts )
171172
172173Ensures type-safe matching of keys and values in update operations.
173174
174175#### ` StrictUpdateFilter<TSchema> `
175- ** Source** : [ src/mongo_types.ts:634 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/mongo_types.ts#L634 )
176+ ** Source** : [ src/mongo_types.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/mongo_types.ts )
176177
177178Provides strict typing for update operators (` $set ` , ` $inc ` , ` $push ` , etc.).
178179
@@ -206,6 +207,46 @@ const update: StrictUpdateFilter<User> = {
206207
207208---
208209
210+ ### Runtime Adapters
211+
212+ ** Status** : ⚠️ Experimental
213+
214+ ** Description** : Allows providing custom implementations of Node.js runtime modules to the driver. This enables the driver to work in non-Node.js JavaScript environments or with alternative module implementations.
215+
216+ ** Types** :
217+
218+ #### ` RuntimeAdapters `
219+ ** Source** : [ src/runtime_adapters.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2.0/src/runtime_adapters.ts )
220+
221+ Interface for providing custom runtime module implementations.
222+
223+ #### ` OsAdapter `
224+ ** Source** : [ src/runtime_adapters.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2.0/src/runtime_adapters.ts )
225+
226+ Represents the required functionality from the Node.js ` os ` module.
227+
228+ ** Available On** :
229+ - ` MongoClientOptions.runtimeAdapters ` - [ src/mongo_client.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2.0/src/mongo_client.ts )
230+
231+ ** Example** :
232+ ``` typescript
233+ // Provide custom OS module implementation
234+ const client = new MongoClient (url , {
235+ runtimeAdapters: {
236+ os: {
237+ release : () => ' custom-release' ,
238+ platform : () => ' linux' ,
239+ arch : () => ' x64' ,
240+ type : () => ' Linux'
241+ }
242+ }
243+ });
244+ ```
245+
246+ ** ⚠️ Important Warning** : This feature is experimental and primarily intended for running the driver in non-Node.js JavaScript runtimes. The API may change in future versions.
247+
248+ ---
249+
209250### Client-Side Encryption Features
210251
211252** Status** : ⚠️ Experimental
@@ -217,7 +258,7 @@ const update: StrictUpdateFilter<User> = {
217258** Option** : ` keyMaterial `
218259** Type** : ` Buffer | Binary `
219260** Location** : ` ClientEncryptionCreateDataKeyProviderOptions `
220- ** Source** : [ src/client-side-encryption/client_encryption.ts:1099 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/client-side-encryption/client_encryption.ts#L1099 )
261+ ** Source** : [ src/client-side-encryption/client_encryption.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/client-side-encryption/client_encryption.ts )
221262
222263** Description** : Allows providing custom key material when creating data keys, giving more control over the encryption key generation process.
223264
@@ -236,8 +277,8 @@ const dataKeyId = await encryption.createDataKey('local', {
236277#### RewrapManyDataKey API
237278
238279** Interfaces** :
239- - ` ClientEncryptionRewrapManyDataKeyProviderOptions ` - [ src/client-side-encryption/client_encryption.ts:889 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/client-side-encryption/client_encryption.ts#L889 )
240- - ` ClientEncryptionRewrapManyDataKeyResult ` - [ src/client-side-encryption/client_encryption.ts:1108 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/client-side-encryption/client_encryption.ts#L1108 )
280+ - ` ClientEncryptionRewrapManyDataKeyProviderOptions ` - [ src/client-side-encryption/client_encryption.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/client-side-encryption/client_encryption.ts )
281+ - ` ClientEncryptionRewrapManyDataKeyResult ` - [ src/client-side-encryption/client_encryption.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/client-side-encryption/client_encryption.ts )
241282
242283** Description** : Experimental API for rewrapping multiple data keys in a single operation, useful for key rotation scenarios.
243284
@@ -265,8 +306,8 @@ interface ClientEncryptionRewrapManyDataKeyResult {
265306** Type** : ` TextQueryOptions `
266307** Location** : ` ClientEncryptionEncryptOptions `
267308** Source** :
268- - Option in ` ClientEncryptionEncryptOptions ` - [ src/client-side-encryption/client_encryption.ts:846 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/client-side-encryption/client_encryption.ts#L846 )
269- - Interface ` TextQueryOptions ` - [ src/client-side-encryption/client_encryption.ts:855 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/client-side-encryption/client_encryption.ts#L855 )
309+ - Option in ` ClientEncryptionEncryptOptions ` - [ src/client-side-encryption/client_encryption.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/client-side-encryption/client_encryption.ts )
310+ - Interface ` TextQueryOptions ` - [ src/client-side-encryption/client_encryption.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/client-side-encryption/client_encryption.ts )
270311
271312** Description** : Options for Queryable Encryption fields supporting text queries. Only valid when the encryption algorithm is set to ` TextPreview ` .
272313
@@ -293,8 +334,8 @@ const encrypted = await encryption.encrypt(value, {
293334** Type** : ` Document `
294335
295336** Available On** :
296- - ` CreateCollectionOptions ` - [ src/operations/create_collection.ts:98 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/operations/create_collection.ts#L98 )
297- - ` DropCollectionOptions ` - [ src/operations/drop.ts:15 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/operations/drop.ts#L15 )
337+ - ` CreateCollectionOptions ` - [ src/operations/create_collection.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/operations/create_collection.ts )
338+ - ` DropCollectionOptions ` - [ src/operations/drop.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/operations/drop.ts )
298339
299340** Description** : Specifies the schema for encrypted fields in a collection, used with Queryable Encryption.
300341
@@ -330,7 +371,7 @@ await db.dropCollection('users', {
330371#### GridFS Read Stream Timeout
331372
332373** Option** : ` timeoutMS ` in ` GridFSBucketReadStreamOptions `
333- ** Source** : [ src/gridfs/index.ts:42 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/gridfs/index.ts#L42 )
374+ ** Source** : [ src/gridfs/index.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/gridfs/index.ts )
334375
335376** Description** : Specifies the lifetime duration of a GridFS read stream. If any async operations are in progress when this timeout expires, the stream will throw a timeout error.
336377
@@ -345,7 +386,7 @@ const downloadStream = bucket.openDownloadStream(fileId, {
345386#### GridFS Write Stream Timeout
346387
347388** Option** : ` timeoutMS ` in ` GridFSBucketWriteStreamOptions `
348- ** Source** : [ src/gridfs/upload.ts:36 ] ( https://github.com/mongodb/node-mongodb-native/blob/v7.1 .0/src/gridfs/upload.ts#L36 )
389+ ** Source** : [ src/gridfs/upload.ts] ( https://github.com/mongodb/node-mongodb-native/blob/v7.2 .0/src/gridfs/upload.ts )
349390
350391** Description** : Specifies the time an upload operation will run until it throws a timeout error.
351392
0 commit comments