|
1 | 1 | ==================
|
2 | 2 | Installation Guide
|
3 | 3 | ==================
|
| 4 | + |
| 5 | +The recommended way to get started using the Node.js driver is by using ``NPM`` (Node Package Manager) to install the dependency in your project. |
| 6 | + |
| 7 | +MongoDB Driver |
| 8 | +-------------- |
| 9 | + |
| 10 | +After you've created your project with ``npm init`` , you can install the MongoDB driver and its dependencies with the command: |
| 11 | + |
| 12 | +.. code-block:: sh |
| 13 | + |
| 14 | + npm install mongodb --save |
| 15 | + |
| 16 | +This will download the MongoDB driver and add a dependency entry in your ``package.json`` file. |
| 17 | + |
| 18 | +Troubleshooting |
| 19 | +--------------- |
| 20 | + |
| 21 | +The MongoDB driver depends on several other packages, including: |
| 22 | + |
| 23 | +* `bson <https://www.npmjs.com/package/bson>`_ |
| 24 | +* `require_optional <https://www.npmjs.com/package/require_optional>`_ |
| 25 | +* `safe-buffer <https://www.npmjs.com/package/safe-buffer>`_ |
| 26 | +* `saslprep <https://www.npmjs.com/package/saslprep>`_ |
| 27 | + |
| 28 | +Additionally, there are multiple optional dependencies that can be installed alongside the driver: |
| 29 | + |
| 30 | +* `bson-ext <https://www.npmjs.com/package/bson-ext>`_ |
| 31 | +* `kerberos <https://www.npmjs.com/package/kerberos>`_ |
| 32 | +* `mongodb-client-encryption <https://www.npmjs.com/package/mongodb-client-encryption>`_ |
| 33 | +* `snappy <https://www.npmjs.com/package/snappy>`_ |
| 34 | + |
| 35 | +These optional modules are all native C++ extensions. They are optional extensions and are not required for the driver to function. Most of these modules use the `prebuild <https://www.npmjs.com/package/prebuild>`_ package to generate pre-built binaries for various operating systems and versions of node. This pre-built version will be downloaded during the ``postinstall`` stage, removing the need to build the native bindings on the system. |
| 36 | + |
| 37 | +bson-ext Module |
| 38 | +--------------- |
| 39 | + |
| 40 | +The ``bson-ext`` module is an alternative **BSON** parser that is written in C++. If you wish to use the ``bson-ext`` module you will need to add the ``bson-ext`` module to your module's dependencies. |
| 41 | + |
| 42 | +.. code-block:: sh |
| 43 | + |
| 44 | + npm install bson-ext --save |
| 45 | + |
| 46 | +kerberos Module |
| 47 | +--------------- |
| 48 | + |
| 49 | +If you need support for connecting to an LDAP environment, you will need to add the ``kerberos`` module to your module's dependencies. |
| 50 | + |
| 51 | +.. code-block:: sh |
| 52 | + |
| 53 | + npm install kerberos --save |
| 54 | + |
| 55 | +For most versions of node and most operating systems, ``kerberos`` will download a binary generated with ``prebuild``, removing the need to compile the native bindings. If your setup is not included in our pre-built binaries, or if you need to build |
| 56 | +kerberos without network access, please see `the kerberos README <https://github.com/mongodb-js/kerberos/blob/master/README.md#requirements>`_ for instructions on how to build the library manually. |
0 commit comments