Skip to content

Commit 6e01bef

Browse files
committed
Merge branch 'feature/10.0' into beta
2 parents 1734dc9 + 139cfde commit 6e01bef

38 files changed

+723
-596
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
node-version: [14.x, 16.x, 18.x, 20.x, 22.x]
20+
node-version: [16.x, 18.x, 20.x, 22.x]
2121
steps:
2222
- uses: actions/checkout@v4
2323
if: github.event.inputs.git-ref == ''
@@ -52,7 +52,7 @@ jobs:
5252
env:
5353
CI: true
5454
- name: Send codecov.io stats
55-
if: matrix.node-version == '14.x'
55+
if: matrix.node-version == '16.x'
5656
uses: codecov/codecov-action@v3
5757

5858
publish:
@@ -61,10 +61,10 @@ jobs:
6161
runs-on: ubuntu-latest
6262
steps:
6363
- uses: actions/checkout@v4
64-
- name: Use Node.js 18
64+
- name: Use Node.js 20
6565
uses: actions/setup-node@v4
6666
with:
67-
node-version: 18.x
67+
node-version: 20.x
6868
- name: Install node_modules
6969
run: yarn install
7070
- name: Build

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ Choose any package, because they are the same. They differ only in the default c
6868

6969
### Requirements
7070

71-
- NodeJS: 14.20.1+
72-
- Typescript: 5.0+ (if used)
71+
- NodeJS: 16.20.1+
72+
- Typescript: 5.3+ (if used)
7373

7474
And one of those (on Linux):
7575

@@ -86,7 +86,7 @@ On Linux, you will also need `libcurl4` (or `libcurl3` on some older distro vers
8686

8787
### Configuring which mongod binary to use
8888

89-
The default behavior is that version `6.0.14` for your OS will be downloaded. By setting [Environment variables](https://nodkz.github.io/mongodb-memory-server/docs/api/config-options) you are able to specify which version and binary will be downloaded:
89+
The default behavior is that version `7.0.9` for your OS will be downloaded. By setting [Environment variables](https://nodkz.github.io/mongodb-memory-server/docs/api/config-options) you are able to specify which version and binary will be downloaded:
9090

9191
```sh
9292
export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.8.tgz
@@ -128,7 +128,7 @@ const mongod = new MongoMemoryServer({
128128
auth?: boolean, // add "--auth" argument, dont use this directly use top-level "auth"
129129
},
130130
binary?: {
131-
version?: string, // by default '6.0.14'
131+
version?: string, // by default '7.0.9'
132132
downloadDir?: string, // see the documentation on what is chosen by default https://nodkz.github.io/mongodb-memory-server/docs/api/config-options#download_dir
133133
platform?: string, // by default os.platform()
134134
arch?: string, // by default os.arch()

docs/api/config-options.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Example: `ubuntu-18.04`
9393

9494
Option `VERSION` is used to set what mongodb version should be downloaded
9595

96-
Default: `6.0.14` (see [Mongodb Server Versions](../guides/mongodb-server-versions.md) for a complete list and policy)
96+
Default: `7.0.9` (see [Mongodb Server Versions](../guides/mongodb-server-versions.md) for a complete list and policy)
9797

9898
This Option does not have a effect when [`ARCHIVE_NAME`](#archive_name) or [`DOWNLOAD_URL`](#download_url) is defined.
9999

@@ -269,20 +269,6 @@ Also see [ARCHIVE_NAME](#archive_name).
269269
Keep in mind that downloaded binaries will never be automatically deleted.
270270
:::
271271

272-
### EXP_NET0LISTEN
273-
274-
| Environment Variable | PackageJson |
275-
| :------------------: | :---------: |
276-
| `MONGOMS_EXP_NET0LISTEN` | `expNet0Listen` |
277-
278-
Option `EXP_NET0LISTEN` is used to use the experimental (non-predictable) port generation of `net.listen`.
279-
280-
This option will use a random open port, which will lessen the "port is already in use" errors, but will not eliminate them.
281-
282-
This is a experimental option, it maybe removed, renamed or have changed behavior in the future.
283-
284-
Default: `false`
285-
286272
## How to use them in the package.json
287273

288274
To use the config options in the `package.json`, they need to be camelCased (and without `_`), and need to be in the property `config.mongodbMemoryServer`
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
id: mongo-memory-dispose-opts
3+
title: 'DisposeOptions'
4+
---
5+
6+
API Documentation of `DisposeOptions`-Interface
7+
8+
## Values for `DisposeOptions`
9+
10+
### enabled
11+
12+
Typings: `enabled?: boolean`
13+
14+
Set whether to stop the manager on `[Symbol.asyncDispose]` calls.
15+
16+
### cleanup
17+
18+
Typings: `cleanup?: Cleanup`
19+
20+
Set custom cleanup options to be used for disposal, see [`cleanup` function](../classes/mongo-memory-server.md#cleanup) (the same options apply for the replset).

docs/api/interfaces/mongo-memory-server-opts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ Set custom spawn options for spawning processes, uses [`SpawnOptions`](https://n
3232
Typings: `auth?: AutomaticAuth`
3333

3434
Set custom Authentication options for the instance, uses [`AutomaticAuth`](./mongo-memory-server-automaticauth.md).
35+
36+
### dispose
37+
38+
Typings: `dispose?: DisposeOptions`
39+
40+
Set custom behavior for when `[Symbol.asyncDispose]` is called, uses [`DisposeOptions`](./mongo-dispose-opts.md).

docs/api/interfaces/replset-opts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ Set how many ReplSet members to spawn, this number will be deducted from length
9191
:::tip
9292
It is recommended to set this number to a **odd** number, and try to never have it be **even**, see [MongoDB Deploy an Odd Number of Members](https://www.mongodb.com/docs/v5.2/core/replica-set-architectures/#deploy-an-odd-number-of-members).
9393
:::
94+
95+
### dispose
96+
97+
Typings: `dispose?: DisposeOptions`
98+
99+
Set custom behavior for when `[Symbol.asyncDispose]` is called, uses [`DisposeOptions`](./mongo-dispose-opts.md).

docs/guides/faq.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,14 @@ Since `8.4.0` objects can also be used instead of just booleans for parameter in
2121

2222
For Example `.stop({ doCleanup: false })` can be used instead of `.stop(false)`.
2323
:::
24+
25+
### Does this package support Explicit Resource Management?
26+
27+
Yes, `[Symbol.asyncDispose]` is implemented for all manager classes, behavior can be configured via `dispose` options:
28+
29+
- [`MongoMemoryServerOpts.dispose`](../api/interfaces/mongo-memory-server-opts.md#dispose)
30+
- [`ReplSetOpts.dispose`](../api/interfaces/replset-opts.md#dispose)
31+
32+
:::note
33+
Note that when using `await using server =` that `[Symbol.asyncDispose]` is called at the end of the scope even if the value is reassigned to something out of the current scope.
34+
:::

docs/guides/migration/migrate10.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
id: migrate10
3+
title: 'Migrate to version 10.0.0'
4+
---
5+
6+
Here are the Important changes made for 10.0.0
7+
8+
:::caution Important, Read this first
9+
This Guide is written for migration from version `9.4.0` to `10.0.0`, for versions `>10.0.0 <11.0.0`, please consult the [CHANGELOG](https://github.com/nodkz/mongodb-memory-server/blob/master/CHANGELOG.md)
10+
:::
11+
12+
## Breaking Changes
13+
14+
### Minimal NodeJS version is now `16`
15+
16+
With 10.0.0 the minimal nodejs required is `16.20.1`.
17+
18+
### Mongodb Driver Version upgraded to 6.x
19+
20+
The used MongoDB Driver version is now `6.7.0`.
21+
22+
### Default binary version is now 7.x
23+
24+
The default binary version has been upgraded from `6.0.x` to `7.0.x`. For more specifics see [mongodb-server-versions](../mongodb-server-versions.md).
25+
26+
:::note
27+
In mongodb `7.0.0` storage engine `ephemeralForTest` has been removed, mongodb-memory-server will automatically translate any occurrence to `wiredTiger` with a warning.
28+
29+
It is recommended to run the tests against a tmpfs or equivalent (default `/tmp` on linux / macos).
30+
:::
31+
32+
## Non-Breaking changes / Additions
33+
34+
### Compiler target is now `es2021`
35+
36+
The tsconfig `target` option has been updated to `es2021`, which will result in less polyfills.
37+
This should be a non-breaking change.
38+
39+
### Getport now uses `net0listen` by default
40+
41+
This means a port is now generated by the engine (like nodejs) itself, previously known as `EXP_NET0LISTEN`.
42+
This should reduce amount of `Max port tries exceeded` errors.

docs/guides/mongodb-server-versions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Starting with MongoDB version 5.0, the default versions for `mongodb-memory-serv
3131

3232
| `mongodb-memory-server-core` Version | Default MongoDB Version |
3333
| :----------------------------------: | :---------------------: |
34+
| 10.0.x - 10.0.x | 7.0.9 |
3435
| 9.2.x - 9.2.x | 6.0.14 |
3536
| 9.0.x - 9.1.x | 6.0.9 |
3637
| 8.14.x - 8.16.x | 5.0.19 |

docs/guides/quick-start-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ If Top-Level async-await is not available for your case, the code can in most ca
1919

2020
## Requirements
2121

22-
- NodeJS: 14.20.1+
23-
- Typescript: 5.0+ (if used)
22+
- NodeJS: 16.20.1+
23+
- Typescript: 5.3+ (if used)
2424

2525
When on Linux, one of the following are required:
2626

0 commit comments

Comments
 (0)