npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mongodb-prebuilt-cross

v5.0.7

Published

Install MongoDB prebuilt binaries via npm with cross platform support.

Downloads

6

Readme

mongodb-prebuilt-cross

badge

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 ;)

Installation

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-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:

sudo npm install -g mongodb-prebuilt

Now you can just run mongod to run mongodb:

mongod

Complete list of programs:

About

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

Programmatic usage

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');
	}
});

start_server(opts, callback)

opts

Type: object

Hash of options.

callback(err)

Type: function

Function called when the mongod is started or returned an error

Options

version

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');
});

args

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,
			dbpath: __dirname + ......
		}
})

logs_callback(buffer)

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());
}

auto_shutdown

Type: boolean Default: false

Will automatically shutdown the mongodb server when the parent process either exits or throws an uncaught exception

Logging

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

Download Proxy

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
# *nix
export https_proxy="https://example.com"
# win32
set https_proxy="https://example.com"