File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # mongo-cli-js
2+ A node.js wrapper for the mongo command line tool
3+
4+ [ ![ NPM] ( https://nodei.co/npm/mongo-cli-js.png?downloads=true&downloadRank=true )] ( https://nodei.co/npm/mongo-cli-js/ )
5+ [ ![ NPM] ( https://nodei.co/npm-dl/mongo-cli-js.png?months=6&height=3 )] ( https://nodei.co/npm/mongo-cli-js/ )
6+
7+ ## Installation
8+
9+ ### Step 1: Prerequisites
10+
11+ The mongodb must be installed and accessible in the path
12+
13+ ### Step 2: Installation
14+
15+ npm install mongo-cli-js
16+
17+ Then:
18+
19+ ``` js
20+ var Mongo = require (' mongo-cli-js' );
21+ ```
22+
23+ ## Usage
24+
25+ With promise
26+
27+ ``` js
28+ var mongo = new Mongo ({
29+ host: ' localhost' ,
30+ port: 27017
31+ });
32+
33+ mongo .command (' db.isMaster()' ).then (function (data ) {
34+ console .log (' data = ' , data);
35+ });
36+
37+
38+ ```
39+
40+ With callback:
41+
42+ ``` js
43+
44+ mongo .command (' db.isMaster()' , function (err , data ) {
45+ console .log (' data = ' , data);
46+ });
47+
48+ ```
49+
You can’t perform that action at this time.
0 commit comments