Skip to content

Commit 9cd0d02

Browse files
committed
init
0 parents  commit 9cd0d02

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+

0 commit comments

Comments
 (0)