Skip to content

Commit 89ea6e8

Browse files
committed
0.0.2
1 parent 3db59c7 commit 89ea6e8

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A node.js wrapper for the mongo command line tool
88

99
### Step 1: Prerequisites
1010

11-
The mongodb must be installed and accessible in the path
11+
mongodb must be installed and accessible in the path
1212

1313
### Step 2: Installation
1414

@@ -34,13 +34,26 @@ mongo.command('db.isMaster()').then(function (data) {
3434
console.log('data = ', data);
3535
});
3636

37-
3837
//data = {
3938
// command: 'mongo --host localhost --port 27017 --eval "db.isMaster()"',
40-
// raw: '["MongoDB shell version: 3.2.0\\nconnecting to: localhost:27017/test\\n{\\n\\t\\"ismaster\\" : false,\\n\\t\\"secondary\\" : false,\\n\\t\\"info\\" : \\"Does not have a valid replica set config\\",\\n\\t\\"isreplicaset\\" : true,\\n\\t\\"maxBsonObjectSize\\" : 16777216,\\n\\t\\"maxMessageSizeBytes\\" : 48000000,\\n\\t\\"maxWriteBatchSize\\" : 1000,\\n\\t\\"localTime\\" : ISODate(\\"2015-12-24T22:19:22.939Z\\"),\\n\\t\\"maxWireVersion\\" : 4,\\n\\t\\"minWireVersion\\" : 0,\\n\\t\\"ok\\" : 1\\n}\\n",""]',
39+
// raw: '["MongoDB shell version: 3.2.0\\nconnecting to: localhost:27017/test\\n{\\n\\t\\"ismaster\\" : false,\\n\\t\\"secondary\\" : false,\\n\\t\\"info\\" : \\"Does not have a valid replica set config\\",\\n\\t\\"isreplicaset\\" : true,\\n\\t\\"maxBsonObjectSize\\" : 16777216,\\n\\t\\"maxMessageSizeBytes\\" : 48000000,\\n\\t\\"maxWriteBatchSize\\" : 1000,\\n\\t\\"localTime\\" : ISODate(\\"2015-12-24T22:29:31.834Z\\"),\\n\\t\\"maxWireVersion\\" : 4,\\n\\t\\"minWireVersion\\" : 0,\\n\\t\\"ok\\" : 1\\n}\\n",""]',
4140
// lines:
4241
// ['MongoDB shell version: 3.2.0',
43-
// 'connecting to: localhost:27017/test'],
42+
// 'connecting to: localhost:27017/test',
43+
// '{',
44+
// '\t"ismaster" : false,',
45+
// '\t"secondary" : false,',
46+
// '\t"info" : "Does not have a valid replica set config",',
47+
// '\t"isreplicaset" : true,',
48+
// '\t"maxBsonObjectSize" : 16777216,',
49+
// '\t"maxMessageSizeBytes" : 48000000,',
50+
// '\t"maxWriteBatchSize" : 1000,',
51+
// '\t"localTime" : ISODate("2015-12-24T22:29:31.834Z"),',
52+
// '\t"maxWireVersion" : 4,',
53+
// '\t"minWireVersion" : 0,',
54+
// '\t"ok" : 1',
55+
// '}',
56+
// ''],
4457
// object:
4558
// {
4659
// ismaster: false,
@@ -50,7 +63,7 @@ mongo.command('db.isMaster()').then(function (data) {
5063
// maxBsonObjectSize: 16777216,
5164
// maxMessageSizeBytes: 48000000,
5265
// maxWriteBatchSize: 1000,
53-
// localTime: { '$date': '2015-12-24T22:19:22.939Z' },
66+
// localTime: { '$date': '2015-12-24T22:29:31.834Z' },
5467
// maxWireVersion: 4,
5568
// minWireVersion: 0,
5669
// ok: 1

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ var extractResult = function (result) {
8080
run: function (resultp) {
8181
var obj = JSON.parse(resultp.raw);
8282
var lines = obj[0].split(os.EOL);
83-
resultp.lines = lines;
83+
resultp.lines = _.clone(lines);
8484

8585
try{
8686
var tempArray = lines.splice(2);
@@ -149,4 +149,4 @@ var cleanJsonDate = function (line) {
149149
}
150150

151151

152-
};
152+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mongo-cli-js",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "A node.js wrapper for the mongo CLI",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)