Skip to content

Commit 0a5a21d

Browse files
committed
Merge branch 'beta' into master
2 parents 3908d79 + 899a710 commit 0a5a21d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5226
-5267
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Top Level; Everything that is not convered by anything below
2-
* @nodkz @AJRdev @hasezoey
2+
* @nodkz @hasezoey
33

44
**/LICENSE.md @nodkz
55
website/ @hasezoey

.github/workflows/tests.yml

+4-4
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: [12.x, 14.x, 16.x, 18.x]
20+
node-version: [14.x, 16.x, 18.x, 20.x]
2121
steps:
2222
- uses: actions/checkout@v4
2323
if: github.event.inputs.git-ref == ''
@@ -49,7 +49,7 @@ jobs:
4949
env:
5050
CI: true
5151
- name: Send codecov.io stats
52-
if: matrix.node-version == '12.x'
52+
if: matrix.node-version == '14.x'
5353
uses: codecov/codecov-action@v3
5454

5555
publish:
@@ -58,10 +58,10 @@ jobs:
5858
runs-on: ubuntu-latest
5959
steps:
6060
- uses: actions/checkout@v4
61-
- name: Use Node.js 12
61+
- name: Use Node.js 18
6262
uses: actions/setup-node@v3
6363
with:
64-
node-version: 12.x
64+
node-version: 18.x
6565
- name: Install node_modules
6666
run: yarn install
6767
- name: Build

.releaserc.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ module.exports = {
1414
{type: "perf", release: "patch"},
1515
{type: "test", release: false},
1616
{type: "chore", release: false},
17+
{type: "deps", release: "minor"},
18+
{type: "devdeps", release: false},
19+
// backwards compatability, remove after 9.0 has been published
1720
{type: "dependencies", release: "minor"},
1821
// dont trigger another release on release commit
1922
{type: "release", release: false}
@@ -37,6 +40,9 @@ module.exports = {
3740
{type: "perf", section: "Performance"},
3841
{type: "test", hidden: true},
3942
{type: "chore", hidden: true},
43+
{type: "deps", section: "Dependencies"},
44+
{type: "devdeps", section: "Dev-Dependencies"},
45+
// backwards compatability, remove after 9.0 has been published
4046
{type: "dependencies", section: "Dependencies"},
4147
{type: "revert", section: "Reverts"},
4248
{type: "release", hidden: true}
@@ -46,7 +52,7 @@ module.exports = {
4652
],
4753
[
4854
// Update versions in sub-packages dependencies
49-
"@google/semantic-release-replace-plugin",
55+
"semantic-release-replace-plugin",
5056
{
5157
"replacements": [
5258
{

CHANGELOG.md

+209
Large diffs are not rendered by default.

README.md

+5-6
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: 12.22+
72-
- Typescript: 4.4+ (if used)
71+
- NodeJS: 14.20.1+
72+
- Typescript: 5.0+ (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 `5.0.19` 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 `6.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
@@ -122,13 +122,12 @@ const mongod = new MongoMemoryServer({
122122
ip?: string, // by default '127.0.0.1', for binding to all IP addresses set it to `::,0.0.0.0`,
123123
dbName?: string, // by default '' (empty string)
124124
dbPath?: string, // by default create in temp directory
125-
storageEngine?: string, // by default `ephemeralForTest`, available engines: [ 'ephemeralForTest', 'wiredTiger' ]
125+
storageEngine?: string, // by default `ephemeralForTest`(unless mongodb 7.0.0, where its `wiredTiger`), available engines: [ 'ephemeralForTest', 'wiredTiger' ]
126126
replSet?: string, // by default no replica set, replica set name
127-
auth?: boolean, // by default `mongod` is started with '--noauth', start `mongod` with '--auth'
128127
args?: string[], // by default no additional arguments, any additional command line arguments for `mongod` `mongod` (ex. ['--notablescan'])
129128
},
130129
binary?: {
131-
version?: string, // by default '5.0.19'
130+
version?: string, // by default '6.0.9'
132131
downloadDir?: string, // see the documentation on what is chosen by default https://nodkz.github.io/mongodb-memory-server/docs/api/config-options#download_dir
133132
platform?: string, // by default os.platform()
134133
arch?: string, // by default os.arch()

commitlint.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module.exports = {
1616
'test',
1717
'chore',
1818
'revert',
19-
'dependencies',
19+
'deps',
20+
'devdeps',
2021
'release',
2122
],
2223
],

docs/api/config-options.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Valid Options are `win32`, `darwin`, `linux`, ~~`sunos`~~(never actually support
4545

4646
Option `ARCH` is used to overwrite the Architecture to download for
4747

48-
Valid Options are `x64`, `arm64`, ~~`ia32`~~([will be removed in 9.0](../guides/error-warning-details.md#mms001))
48+
Valid Options are `x64`, `arm64`
4949

5050
[See here for what versions are available for what architectures](https://www.mongodb.com/download-center/community/releases/archive)
5151

@@ -171,7 +171,7 @@ Default: `true`
171171

172172
Option `MD5_CHECK` is used to enable an md5 check after download
173173

174-
Default: `false`
174+
Default: `true`
175175

176176
### ARCHIVE_NAME
177177

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

+10-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ This option will automatically be set with a directory generated by [`mkdtemp`](
7272
### storageEngine
7373

7474
Typings: `storageEngine?: StorageEngine`
75-
Default: `ephemeralForTest`
75+
Default: `ephemeralForTest` (unless mongodb version is `7.0.0`, where its `wiredTiger`)
7676

7777
Set which storage engine to use, uses [`StorageEngine`](#helper-type-storageengine).
7878

@@ -85,13 +85,19 @@ Only has a effect when started with [`MongoMemoryReplSet`](../classes/mongo-memo
8585

8686
## Helper Type `StorageEngine`
8787

88-
Typings: `StorageEngine = 'devnull' | 'ephemeralForTest' | 'mmapv1' | 'wiredTiger'`
88+
Typings: `StorageEngine = 'ephemeralForTest' | 'wiredTiger'`
8989

9090
Storage Engines supported by mongodb, see [MongoDB Storage Engines](https://www.mongodb.com/docs/manual/core/storage-engines/).
9191

9292
Custom Explanation:
9393

94-
- `devnull` is a storage engine which discards everything and cannot be read from.
9594
- `ephemeralForTest` is a in-memory storage engine, which stores everything in RAM, which is great to use when wanting a simple database testing backend, is not the same as the Enterprise In-Memory Engine
96-
- `mmapv1` is storage engine which stores data on disk, was removed in mongodb 4.2
9795
- `wiredTiger` is a storage engine which stores data on disk.
96+
97+
:::warning
98+
MongoDB has stated that storage-engine `ephemeralForTest` is unstable and has been deprecated, it will be removed with mongodb 7.
99+
100+
In MMS there has been no observation of `ephemeralForTest` being unstable (aside from some missing features) and will continue to be the default until mongodb-memory-server changes to a version where `ephemeralForTest` is not present anymore.
101+
102+
With mongodb-memory-server 9.0.0, if mongodb 7.0.0 or higher is used, `wiredTiger` is the default engine.
103+
:::

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ API Documentation of `AutomaticAuth`-Interface
77

88
## Values
99

10-
### disable
10+
### enable
1111

12-
Typings: `disable?: boolean`
12+
Typings: `enable?: boolean`
1313
Default: `false`
1414

15-
Disable Authentication creation.
16-
Normally authentication is enabled when the `auth` field a object, but with this option it can be explicitly disabled.
15+
Enable or disable Authentication creation.
1716

1817
### extraUsers
1918

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ API Documentation of `MongoMemoryServerOpts`-Interface
99

1010
### instance
1111

12-
Typings: `instance?: MongoMemoryInstanceOpts`
12+
Typings: `instance?: MemoryServerInstanceOpts`
1313

14-
Set custom options for the instance, uses [`MongoMemoryInstanceOpts`](./mongo-memory-instance-opts.md).
14+
Set custom options based on [`MongoMemoryInstanceOpts`](./mongo-memory-instance-opts.md), but ignores some properties:
15+
16+
- `auth` is ignored because it is set via [auth](#auth) property.
1517

1618
### binary
1719

docs/api/interfaces/replset-opts.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ API Documentation of `ReplSetOpts`-Interface
99

1010
### auth
1111

12-
Typings: `auth?: boolean | AutomaticAuth`
13-
Default: `false`
12+
Typings: `auth?: AutomaticAuth`
13+
Default: `{ enable: false }`
1414

15-
Set wheter to enable Authentication, with configuration from [`AutomaticAuth`](./mongo-memory-server-automaticauth.md).
15+
Set whether to enable Authentication, with configuration from [`AutomaticAuth`](./mongo-memory-server-automaticauth.md).
1616

1717
Also see [`MongoMemoryInstanceOpts.auth`](./mongo-memory-instance-opts.md#auth).
1818

@@ -66,7 +66,7 @@ Also see [`MongoMemoryInstanceOpts.spawn`](./mongo-memory-instance-opts.md#spawn
6666
### storageEngine
6767

6868
Typings: `storageEngine?: StorageEngine`
69-
Default: `"ephemeralForTest"`
69+
Default: `"ephemeralForTest"` (unless mongodb version is `7.0.0`, where its `wiredTiger`)
7070

7171
Set which Storage Engine to use, uses [`StorageEngine`](./mongo-memory-instance-opts.md#helper-type-storageengine).
7272

docs/guides/error-warning-details.md

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ Default Timeout: `1000 * 30` (30 seconds)
6868

6969
## EnsureInstanceError
7070

71+
:::note
72+
Merged into [`InstanceInfoError`](#instanceinfoerror) in 9.0.0
73+
:::
74+
7175
Example:
7276

7377
- `${baseMesasge} state was "running" but "instanceInfo" was undefined!`
@@ -168,6 +172,13 @@ Example: `ReplSet Count needs to be 1 or higher! (specified count: "${count}")`
168172
Details:
169173
ReplSet count (like `new MongoMemoryReplSet({ replSet: { count: 0 } })`) needs to be `1` or higher
170174

175+
## UnknownLinuxDistro
176+
177+
Example: `Unknown/unsupported linux "${distro}" id_like's: [${id_like?.join(', ')}]`
178+
179+
Details:
180+
The Linux distro in use does not have a mapping for a mongodb version, please report this issue if the distro / idlike is not mentioned in [Supported Systems](./supported-systems.md).
181+
171182
## Deprecation Codes
172183

173184
### MMS001

docs/guides/migration/migrate7.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This Guide is written for migration from version `6.9.6` to `7.0.0`, for version
1111

1212
## Requirement Changes
1313

14-
- Nodejs `10` & `11` are now unsupported, lowest supported version is now `12.22`
14+
- Nodejs `10` & `11` are now unsupported, lowest supported version is now `14.0`
1515

1616
## Breaking Changes
1717

docs/guides/migration/migrate9.md

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
id: migrate9
3+
title: 'Migrate to version 9.0.0'
4+
---
5+
6+
Here are the Important changes made for 9.0.0
7+
8+
:::caution Important, Read this first
9+
This Guide is written for migration from version `8.16.0` to `9.0.0`, for versions `>9.0.0 <10.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 `14`
15+
16+
With 9.0.0 the minimal nodejs required is `14.20.1`.
17+
18+
### Mongodb Driver Version upgraded to 5.x
19+
20+
The used MongoDB Driver version is now `5.9.0`.
21+
22+
### Default binary version is now 6.x
23+
24+
The default binary version has been upgraded from `5.0.x` to `6.0.x`. For more specifics see [mongodb-server-versions](../mongodb-server-versions.md).
25+
26+
### Removed platform translations
27+
28+
Some platform translations have been removed, because they are either not needed anymore or werent properly supported in the first place:
29+
30+
- `sunos` -> `linux`
31+
- `elementary OS` -> `linux`
32+
33+
### Removed architectures
34+
35+
Some architectures were removed because they were not being build by mongodb anymore and support in mongodb-memory-server has been largely untested:
36+
37+
- `ia32` -> `i686` / `i386`
38+
39+
### MongoMemoryServer `instance.auth` option is now ignored
40+
41+
With 9.0.0 the option `instance.auth` option is going to be ignored, because its set via the (top-level) `auth` option directly.
42+
43+
Example:
44+
45+
`new MongoMemoryServer({ instance: { auth: true } })` is going to be ignored, use `new MongoMemoryServer({ auth: { enable: true } })`
46+
47+
### `AutomaticAuth` changes
48+
49+
`AutomaticAuth` has been changed to **not** be enabled anymore by just having a empty object. Also property `disable` has been removed and `enable` has been added.
50+
51+
Replace `auth: {}` with `auth: { enable: true }`.
52+
Replace `auth: { disable: true }` with `auth: { enable: false }`.
53+
Replace `auth: { disable: false }` with `auth: { enable: true }`.
54+
55+
### MongoMemoryServer and MongoReplSet `.cleanup(boolean)` and `.stop(boolean)` have been removed
56+
57+
Previously `boolean` was the only option for the `.cleanup` and `.stop` function, but they behaved differently between those 2 function and were replaced with `Cleanup` object-options and now have been completely removed.
58+
59+
Replace `.stop(true)` with `.stop({ doCleanup: true })`.
60+
Replace `.cleanup(true)` with `.stop({ doCleanup: true, force: true })`.
61+
62+
Default is still for both `{ doCleanup: true, force: false }`.
63+
64+
### `MD5_CHECK` is now enabled by default
65+
66+
The config option [`MD5_CHECK`](../../api/config-options.md#md5_check) has been enabled by default now, resulting in always comparing the downloaded archive with a md5 after a download.
67+
68+
### Merged Error types
69+
70+
Some error classes have been merged:
71+
72+
- `EnsureInstanceError` & `InstanceInfoError` -> `InstanceInfoError`
73+
- `NoSystemBinaryFoundError` & `BinaryNotFoundError` -> `BinaryNotFoundError`
74+
75+
### Removed Storage engine `devnull` and `mmapv1`
76+
77+
Storage Engines `devnull` and `mmapv1` have been removed because they are not supported in newer versions of mongodb anymore, `wiredTiger` should be used instead.
78+
79+
### Linux fallback binary has been removed
80+
81+
Previously there was a code-path for a fallback linux binary, but this has been removed because mongodb has stopped shipping generic linux binaries since versions after 4.0.
82+
83+
If a fallback is still required, try to use the ubuntu binary via [Config Options `DISTRO`](../../api/config-options.md#distro).
84+
85+
### Ubuntu fallback year has been updated
86+
87+
The ubuntu fallback year has been updated to `22`, instead of the previous `14`, because newer versions of mongodb dont ship for any EOL ubuntu version anymore.
88+
89+
This fallback is only used if the ubuntu year could not be parsed from the os-file.
90+
This can also be overwritten with [Config Option `DISTRO`](../../api/config-options.md#distro).
91+
92+
## Non-Breaking changes / Additions
93+
94+
### Compiler target is now `es2019`
95+
96+
The tsconfig `target` option has been updated to `es2019`, which will result in less polyfills.
97+
This should be a non-breaking change
98+
99+
## Crypto function have been changed to use nodejs internals
100+
101+
Crypto functions like for the md5 check and uuidv4 generation have been moved to use the `node:crypto` support, resulting in dropping 2 dependencies.
102+
103+
Dropped dependencies are `md5-file` and `uuid`.
104+
105+
## Binary childprocess is now also `.unref()`
106+
107+
The Mongodb Binary childprocess is now also `.unref()`, like the killer process has been for some time.
108+
109+
This *should* help with non-closed instances not exiting the nodejs process.
110+
111+
## The port testing package has been replaced
112+
113+
Previously MMS used `get-port`, but it caused some big memory-leakage across big projects, so it has been replaced with one that uses less maps.
114+
115+
It also has been replaced because newer versions were ESM only, but we couldnt switch to ESM yet (and using ESM in CommonJS is not a great experience)
116+
117+
## Mongodb version 7.0.0 is now supported
118+
119+
Mongob version `7.0.0` removed storage engine `ephemeralForTest`, with mongodb-memory-server 9.0.0 storage engine `wiredTiger` is the default for binary versions `7.0.0` and higher.
120+
Older versions (before `7.0.0`) will still continue to use `ephemeralForTest` by default.
121+
122+
:::info
123+
The version used for the decision is the version provided via the resolved [`VERSION`](../../api/config-options.md#version) config option.
124+
This mean it needs to match the version the system binary is (a warning is printed if they are not the same).
125+
126+
If the option is unset, the default version will be used, which is likely not correct for the system binary.
127+
128+
If the decision should not be automatic, the storage engine can be explicitly defined as a instance option.
129+
:::
130+
131+
It is recommended to run those instances with a db path which is equivalent to [`tmpfs`](https://wiki.archlinux.org/title/tmpfs).

docs/guides/mongodb-server-versions.md

+1
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+
| 9.0.x - 9.0.x | 6.0.9 |
3435
| 8.14.x - 8.13.x | 5.0.19 |
3536
| 8.13.x - 8.13.x | 5.0.18 |
3637
| 8.11.x - 8.12.x | 5.0.13 |

0 commit comments

Comments
 (0)