1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
==================
Installation Guide
==================
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.
MongoDB Driver
--------------
After you've created your project with ``npm init`` , you can install the MongoDB driver and its dependencies with the command:
.. code-block:: sh
npm install mongodb --save
This will download the MongoDB driver and add a dependency entry in your ``package.json`` file.
Troubleshooting
---------------
The MongoDB driver depends on several other packages, including:
* `bson <https://www.npmjs.com/package/bson>`_
* `require_optional <https://www.npmjs.com/package/require_optional>`_
* `safe-buffer <https://www.npmjs.com/package/safe-buffer>`_
* `saslprep <https://www.npmjs.com/package/saslprep>`_
Additionally, there are multiple optional dependencies that can be installed alongside the driver:
* `bson-ext <https://www.npmjs.com/package/bson-ext>`_
* `kerberos <https://www.npmjs.com/package/kerberos>`_
* `mongodb-client-encryption <https://www.npmjs.com/package/mongodb-client-encryption>`_
* `snappy <https://www.npmjs.com/package/snappy>`_
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.
bson-ext Module
---------------
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.
.. code-block:: sh
npm install bson-ext --save
kerberos Module
---------------
If you need support for connecting to an LDAP environment, you will need to add the ``kerberos`` module to your module's dependencies.
.. code-block:: sh
npm install kerberos --save
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
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.
|