Install mongodb prebuilt binaries for command-line use using npm. This module helps you easily install the
mongodb command for use on the command line without having to compile anything.
MongoDB is an open-source, document database designed for ease of development and scaling.
IMPORTANT: The main repository has no windows support and the maintainer seems to be inactive. Thanks @ralflizard for adding windows support. I will maintain this project so create an issue or PR ;)
Download and install the latest build of mongodb for your OS and add it to your projects
package.json as a
npm install mongodb-prebuilt-cross --save-dev
You can also use the
-g flag (global) to symlink it into your PATH:
npm install -g mongodb-prebuilt-cross
If that command fails with an
EACCESS error you may have to run it again with
sudo npm install -g mongodb-prebuilt
Now you can just run
mongod to run mongodb:
Complete list of programs:
Works on Mac, Windows, Linux and Solaris OSes that MongoDB supports.
The version numbers of this module DO NOT match the version number of the offical MongoDB releases. By default, latest production release will be selected. Different version is set via
npm install --mongodb-version=320 mongodb-prebuilt
var mongodb_prebuilt = ;mongodb_prebuilt;
Function called when the
mongod is started or returned an error
Optional version of MongoDB can be specified, if it doesn't match latest version, and it is a first time you are running this version, mongodb-prebuilt will have to go through the install process first.
Optional arguments that are going to be passed to mongod, if argument doesn't have a value, set that value to true. To see complete list of supported arguments for your version run:
example of start_server with arguments
Optional logs handler.
Will automatically shutdown the mongodb server when the parent process either exits or throws an uncaught exception
To see logs in stdout, set environment variable DEBUG to
export DEBUG=mongodb// without exportDEBUG=mongodb node myapp.js
If you require proxy to reach outside networks, you may do it by:
- pass extra argument to npm install
npm install --https-proxy="https://example.com"
- set environment variable with https_proxy
# *nixexport https_proxy="https://example.com"# win32set https_proxy="https://example.com"