
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
mongodb-prebuilt
Advanced tools
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.
Download and install the latest build of mongodb for your OS and add it to your projects package.json
as a devDependency
:
npm install mongodb-prebuilt --save-dev
You can also use the -g
flag (global) to symlink it into your PATH:
npm install -g mongodb-prebuilt
If that command fails with an EACCESS
error you may have to run it again with sudo
:
sudo npm install -g mongodb-prebuilt
Now you can just run mongod
to run mongodb:
mongod
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 mongodb-version
option:
npm install --mongodb-version=3.2.0 mongodb-prebuilt
var mongodb_prebuilt = require('mongodb-prebuilt');
mongodb_prebuilt.start_server({}, function(err) {
if (err) {
console.log('mongod didnt start:', err);
} else {
console.log('mongod is started');
}
});
Type: object
Hash of options
.
Type: function
Function called when the mongod
is started or returned an error
Type: string
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.
mongodb_prebuilt.start_server({
version: "3.2.0"
}, function(err) {
if (!err) console.log('server started');
});
Type: function
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:
mongod --help
example of start_server with arguments
mongodb_prebuilt.start_server({
args: {
port: 27017,
quiet: true
}
})
Type: function
Optional logs handler.
mongodb_prebuilt.start_server({
logs_callback: logs_callback
}, function(err) {});
function logs_callback(buffer) {
console.log("log message:", buffer.toString());
}
Type: boolean
Default: false
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 mongodb
*nix
export DEBUG=mongodb
// without export
DEBUG=mongodb node myapp.js
windows
set DEBUG=mongodb
If you require proxy to reach outside networks, you may do it by:
npm install --https-proxy="https://example.com"
# *nix
export https_proxy="https://example.com"
# win32
set https_proxy="https://example.com"
FAQs
Install MongoDB prebuilt binaries via npm
The npm package mongodb-prebuilt receives a total of 2,560 weekly downloads. As such, mongodb-prebuilt popularity was classified as popular.
We found that mongodb-prebuilt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.