|
8 | 8 |
|
9 | 9 | This package spins up a actual/real MongoDB Server programmatically from node for testing or mocking during development. By default it holds the data in memory. Fresh spinned up `mongod` process takes about 7Mb of memory. The server will allow you to connect your favorite ODM or client library to the MongoDB Server and run integration tests isolated from each other. |
10 | 10 |
|
11 | | -This package on install downloads the latest MongoDB binaries and save it to cache folder. So first run may take a time. All further runs will fast, because use already downloaded binaries. |
| 11 | +On install, this package downloads the latest MongoDB binaries and saves it to a cache folder. |
12 | 12 |
|
13 | | -This package automatically downloads binaries from [https://fastdl.mongodb.org/](https://fastdl.mongodb.org/) according to your operation system. You can see all available versions by the following links [Linux](https://www.mongodb.org/dl/linux) (Ubuntu, RHEL, Debian, SUSE, Amazon), [OSX](https://www.mongodb.org/dl/osx), [Win](https://www.mongodb.org/dl/win32). |
| 13 | +On starting a new instance of the memory server, if the binary cannot be found, it will be auto-downloaded. So the first run may take some time. All further runs will be fast, because they will use the downloaded binaries. |
| 14 | + |
| 15 | +This package automatically downloads binaries from [https://fastdl.mongodb.org/](https://fastdl.mongodb.org/) according to your operating system. You can see all available versions by the following links [Linux](https://www.mongodb.org/dl/linux) (Ubuntu, RHEL, Debian, SUSE, Amazon), [OSX](https://www.mongodb.org/dl/osx), [Win](https://www.mongodb.org/dl/win32). |
14 | 16 |
|
15 | 17 | Every `MongoMemoryServer` instance creates and starts fresh MongoDB server on some free port. You may start up several mongod simultaneously. When you terminate your script or call `stop()` MongoDB server(s) will be automatically shutdown. |
16 | 18 |
|
17 | 19 | Perfectly [works with Travis CI](https://github.com/nodkz/graphql-compose-mongoose/commit/7a6ac2de747d14281f9965f418065e97a57cfb37) without additional `services` and `addons` options in `.travis.yml`. |
18 | 20 |
|
19 | 21 | ## Installation |
20 | 22 |
|
21 | | -This tool provides several packages for different purposes: |
| 23 | +This tool provides three packages for different purposes: |
22 | 24 |
|
23 | | -- with auto-download mongod binary on npm install (5 different ways) |
24 | | -- without auto-download (core package) |
| 25 | +- With auto-download mongod binary on npm install |
| 26 | +- Without auto-download on npm install |
25 | 27 |
|
26 | 28 | Choose any package, because they are the same. Differs only by default configuration, which you may override (see section [Available options](#available-options)). |
27 | 29 |
|
28 | | -### With auto-download `latest` Mongod binary on npm install to `node_modules/.cache` |
| 30 | +### `mongodb-memory-server` |
| 31 | + |
| 32 | +Auto-downloads the latest `mongod` binary on npm install to: `node_modules/.cache`. |
29 | 33 |
|
30 | 34 | ```bash |
31 | 35 | yarn add mongodb-memory-server --dev |
32 | 36 | OR |
33 | 37 | npm install mongodb-memory-server --save-dev |
34 | 38 | ``` |
35 | 39 |
|
36 | | -### With auto-download `latest` Mongod binary on npm install to `%HOME/.cache` |
| 40 | +### `mongodb-memory-server-global` |
| 41 | + |
| 42 | +Auto-downloads the latest `mongod` binary on npm install to: `%HOME/.cache`. |
37 | 43 |
|
38 | 44 | ```bash |
39 | 45 | yarn add mongodb-memory-server-global --dev |
40 | 46 | OR |
41 | 47 | npm install mongodb-memory-server-global --save-dev |
42 | 48 | ``` |
43 | 49 |
|
44 | | -### Without auto-download |
| 50 | +### `mongodb-memory-server-core` |
| 51 | + |
| 52 | +Does NOT auto-download `mongod` on npm install. |
45 | 53 |
|
46 | 54 | ```bash |
47 | 55 | yarn add mongodb-memory-server-core --dev |
48 | 56 | OR |
49 | 57 | npm install mongodb-memory-server-core --save-dev |
50 | 58 | ``` |
51 | 59 |
|
| 60 | +_Note: the package does try to download `mongod` upon server start if it cannot find the binary._ |
| 61 | + |
52 | 62 | ## Usage |
53 | 63 |
|
54 | 64 | ### Simple server start: |
|
0 commit comments