{"id":21377708,"url":"https://github.com/quobject/mongo-cli-js","last_synced_at":"2025-03-16T09:45:39.842Z","repository":{"id":46342948,"uuid":"48556764","full_name":"Quobject/mongo-cli-js","owner":"Quobject","description":"A node.js wrapper for the mongo command line tool","archived":false,"fork":false,"pushed_at":"2021-11-13T01:57:58.000Z","size":54,"stargazers_count":0,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T02:40:01.107Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quobject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-24T21:02:59.000Z","updated_at":"2021-11-13T01:58:00.000Z","dependencies_parsed_at":"2022-09-19T19:20:59.725Z","dependency_job_id":null,"html_url":"https://github.com/Quobject/mongo-cli-js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fmongo-cli-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fmongo-cli-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fmongo-cli-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fmongo-cli-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quobject","download_url":"https://codeload.github.com/Quobject/mongo-cli-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852430,"owners_count":20358270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T09:23:25.115Z","updated_at":"2025-03-16T09:45:39.819Z","avatar_url":"https://github.com/Quobject.png","language":"TypeScript","readme":"# mongo-cli-js\nA node.js wrapper for the mongo command line tool\n\n[![NPM](https://nodei.co/npm/mongo-cli-js.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/mongo-cli-js/)\n[![NPM](https://nodei.co/npm-dl/mongo-cli-js.png?months=6\u0026height=3)](https://nodei.co/npm/mongo-cli-js/)\n\n[![NPM version][npm-image]][npm-url]\n[![NPM downloads][downloads-image]][downloads-url]\n\n## Installation\n\n### Warning\n\nCode uses exec = child_process.exec; https://github.com/Quobject/docker-cli-js/issues/22\n\n### Step 1: Prerequisites\n\nmongodb must be installed and accessible in the path\n\n### Step 2: Installation\n    \n    npm install mongo-cli-js\n    \nThen:\n\n```js\nvar mongoCli = require('mongo-cli-js');\n```\n\n## Usage\n\nWith promise\n\n```js\nvar Options = mongoCli.Options;\nvar Mongo = mongoCli.Mongo;\n \nvar options = new Options(\n    /* currentWorkingDirectory */ null,\n    /* host */ 'localhost', \n    /* port */ '27017', \n);\n\nvar mongo = new Mongo(options);\n\nmongo.command('db.isMaster()').then(function (data) {\n  console.log('data = ', data); \n});\n\n//data = {\n//  command: 'mongo --host localhost --port 27017  --eval \"db.isMaster()\"',\n//  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',\n//  lines:\n//   ['MongoDB shell version: 3.2.0',\n//     'connecting 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//     ''],\n//  object:\n//   {\n//     ismaster: false,\n//     secondary: false,\n//     info: 'Does not have a valid replica set config',\n//     isreplicaset: true,\n//     maxBsonObjectSize: 16777216,\n//     maxMessageSizeBytes: 48000000,\n//     maxWriteBatchSize: 1000,\n//     localTime: { '$date': '2015-12-24T22:29:31.834Z' },\n//     maxWireVersion: 4,\n//     minWireVersion: 0,\n//     ok: 1\n//   }\n//}\n\n```\n\nWith callback:\n\n```js\n\nmongo.command('db.isMaster()', function (err, data) {\n  console.log('data = ', data);\n});\n\n```\n\nTypescript\n```js\nimport { Mongo, Options } from 'mongo-cli-js';\n\nconst options = new Options(\n    /* currentWorkingDirectory */ null,\n    /* host */ 'localhost', \n    /* port */ '27017', \n);\n\nconst mongo = new Mongo(options);\n\nmongo.command('db.isMaster()').then(function (data) {\n  console.log('data = ', data);\n});\n```\n\n\n* rs.conf()\n\n```js\n\nmongo.command('rs.conf()').then(function (data) {\n  console.log('data = ', data); \n});\n\n\n//data = {\n//  command: 'mongo --host localhost --port 27017  --eval \"rs.conf();\"',\n//  raw: 'MongoDB shell version: 3.2.0\\\\nconnecting to: localhost:27017/test\\\\n{\\\\n\\\\t\\\\\"_id\\\\\" : \\\\\"mongodb\\\\\",\\\\n\\\\t\\\\\"version\\\\\" : 1,\\\\n\\\\t\\\\\"protocolVersion\\\\\" : NumberLong(1),\\\\n\\\\t\\\\\"members\\\\\" : [\\\\n\\\\t\\\\t{\\\\n\\\\t\\\\t\\\\t\\\\\"_id\\\\\" : 0,\\\\n\\\\t\\\\t\\\\t\\\\\"host\\\\\" : \\\\\"mongodb1:27017\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"arbiterOnly\\\\\" : false,\\\\n\\\\t\\\\t\\\\t\\\\\"buildIndexes\\\\\" : true,\\\\n\\\\t\\\\t\\\\t\\\\\"hidden\\\\\" : false,\\\\n\\\\t\\\\t\\\\t\\\\\"priority\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"tags\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\n\\\\t\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\t\\\\\"slaveDelay\\\\\" : NumberLong(0),\\\\n\\\\t\\\\t\\\\t\\\\\"votes\\\\\" : 1\\\\n\\\\t\\\\t}\\\\n\\\\t],\\\\n\\\\t\\\\\"settings\\\\\" : {\\\\n\\\\t\\\\t\\\\\"chainingAllowed\\\\\" : true,\\\\n\\\\t\\\\t\\\\\"heartbeatIntervalMillis\\\\\" : 2000,\\\\n\\\\t\\\\t\\\\\"heartbeatTimeoutSecs\\\\\" : 10,\\\\n\\\\t\\\\t\\\\\"electionTimeoutMillis\\\\\" : 10000,\\\\n\\\\t\\\\t\\\\\"getLastErrorModes\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\n\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\\"getLastErrorDefaults\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\\"w\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"wtimeout\\\\\" : 0\\\\n\\\\t\\\\t}\\\\n\\\\t}\\\\n}\\\\n',\n//  lines:\n//   ['MongoDB shell version: 3.2.0',\n//     'connecting to: localhost:27017/test',\n//     '{',\n//     '\\t\"_id\" : \"mongodb\",',\n//     '\\t\"version\" : 1,',\n//     '\\t\"protocolVersion\" : NumberLong(1),',\n//     '\\t\"members\" : [',\n//     '\\t\\t{',\n//     '\\t\\t\\t\"_id\" : 0,',\n//     '\\t\\t\\t\"host\" : \"mongodb1:27017\",',\n//     '\\t\\t\\t\"arbiterOnly\" : false,',\n//     '\\t\\t\\t\"buildIndexes\" : true,',\n//     '\\t\\t\\t\"hidden\" : false,',\n//     '\\t\\t\\t\"priority\" : 1,',\n//     '\\t\\t\\t\"tags\" : {',\n//     '\\t\\t\\t\\t',\n//     '\\t\\t\\t},',\n//     '\\t\\t\\t\"slaveDelay\" : NumberLong(0),',\n//     '\\t\\t\\t\"votes\" : 1',\n//     '\\t\\t}',\n//     '\\t],',\n//     '\\t\"settings\" : {',\n//     '\\t\\t\"chainingAllowed\" : true,',\n//     '\\t\\t\"heartbeatIntervalMillis\" : 2000,',\n//     '\\t\\t\"heartbeatTimeoutSecs\" : 10,',\n//     '\\t\\t\"electionTimeoutMillis\" : 10000,',\n//     '\\t\\t\"getLastErrorModes\" : {',\n//     '\\t\\t\\t',\n//     '\\t\\t},',\n//     '\\t\\t\"getLastErrorDefaults\" : {',\n//     '\\t\\t\\t\"w\" : 1,',\n//     '\\t\\t\\t\"wtimeout\" : 0',\n//     '\\t\\t}',\n//     '\\t}',\n//     '}',\n//     ''],\n//  object:\n//   {\n//     _id: 'mongodb',\n//     version: 1,\n//     protocolVersion: { '$numberLong': '1),' },\n//     members:\n//      [{\n//        _id: 0,\n//        host: 'mongodb1:27017',\n//        arbiterOnly: false,\n//        buildIndexes: true,\n//        hidden: false,\n//        priority: 1,\n//        tags: {},\n//        slaveDelay: { '$numberLong': '0),' },\n//        votes: 1\n//      }],\n//     settings:\n//      {\n//        chainingAllowed: true,\n//        heartbeatIntervalMillis: 2000,\n//        heartbeatTimeoutSecs: 10,\n//        electionTimeoutMillis: 10000,\n//        getLastErrorModes: {},\n//        getLastErrorDefaults: { w: 1, wtimeout: 0 }\n//      }\n//   }\n//}\n```\n\n* rs.initiate()\n\n```js\n\nmongo.command('rs.initiate()').then(function (data) {\n  console.log('data = ', data); \n});\n\n\n//data = {\n//  command: 'mongo --host localhost --port 27017  --eval \"rs.initiate()\"',\n//  raw: 'MongoDB shell version: 3.2.0\\\\nconnecting to: localhost:27017/test\\\\n{\\\\n\\\\t\\\\\"info2\\\\\" : \\\\\"no configuration specified. Using a default configuration for the set\\\\\",\\\\n\\\\t\\\\\"me\\\\\" : \\\\\"mongodb1:27017\\\\\",\\\\n\\\\t\\\\\"info\\\\\" : \\\\\"try querying local.system.replset to see current configuration\\\\\",\\\\n\\\\t\\\\\"ok\\\\\" : 0,\\\\n\\\\t\\\\\"errmsg\\\\\" : \\\\\"already initialized\\\\\",\\\\n\\\\t\\\\\"code\\\\\" : 23\\\\n}\\\\n',\n//  lines:\n//   ['MongoDB shell version: 3.2.0',\n//     'connecting to: localhost:27017/test',\n//     '{',\n//     '\\t\"info2\" : \"no configuration specified. Using a default configuration for the set\",',\n//     '\\t\"me\" : \"mongodb1:27017\",',\n//     '\\t\"info\" : \"try querying local.system.replset to see current configuration\",',\n//     '\\t\"ok\" : 0,',\n//     '\\t\"errmsg\" : \"already initialized\",',\n//     '\\t\"code\" : 23',\n//     '}',\n//     ''],\n//  object:\n//   {\n//     info2: 'no configuration specified. Using a default configuration for the set',\n//     me: 'mongodb1:27017',\n//     info: 'try querying local.system.replset to see current configuration',\n//     ok: 0,\n//     errmsg: 'already initialized',\n//     code: 23\n//   }\n//}\n```\n\n\n* rs.conf()\n\n```js\n\nmongo.command('rs.conf()').then(function (data) {\n  console.log('data = ', data); \n});\n\n\n//data = {\n//  command: 'mongo --host localhost --port 27017  --eval \"rs.conf();\"',\n//  raw: 'MongoDB shell version: 3.2.0\\\\nconnecting to: localhost:27017/test\\\\n{\\\\n\\\\t\\\\\"_id\\\\\" : \\\\\"mongodb\\\\\",\\\\n\\\\t\\\\\"version\\\\\" : 1,\\\\n\\\\t\\\\\"protocolVersion\\\\\" : NumberLong(1),\\\\n\\\\t\\\\\"members\\\\\" : [\\\\n\\\\t\\\\t{\\\\n\\\\t\\\\t\\\\t\\\\\"_id\\\\\" : 0,\\\\n\\\\t\\\\t\\\\t\\\\\"host\\\\\" : \\\\\"mongodb1:27017\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"arbiterOnly\\\\\" : false,\\\\n\\\\t\\\\t\\\\t\\\\\"buildIndexes\\\\\" : true,\\\\n\\\\t\\\\t\\\\t\\\\\"hidden\\\\\" : false,\\\\n\\\\t\\\\t\\\\t\\\\\"priority\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"tags\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\n\\\\t\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\t\\\\\"slaveDelay\\\\\" : NumberLong(0),\\\\n\\\\t\\\\t\\\\t\\\\\"votes\\\\\" : 1\\\\n\\\\t\\\\t}\\\\n\\\\t],\\\\n\\\\t\\\\\"settings\\\\\" : {\\\\n\\\\t\\\\t\\\\\"chainingAllowed\\\\\" : true,\\\\n\\\\t\\\\t\\\\\"heartbeatIntervalMillis\\\\\" : 2000,\\\\n\\\\t\\\\t\\\\\"heartbeatTimeoutSecs\\\\\" : 10,\\\\n\\\\t\\\\t\\\\\"electionTimeoutMillis\\\\\" : 10000,\\\\n\\\\t\\\\t\\\\\"getLastErrorModes\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\n\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\\"getLastErrorDefaults\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\\"w\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"wtimeout\\\\\" : 0\\\\n\\\\t\\\\t}\\\\n\\\\t}\\\\n}\\\\n',\n//  lines:\n//   ['MongoDB shell version: 3.2.0',\n//     'connecting to: localhost:27017/test',\n//     '{',\n//     '\\t\"_id\" : \"mongodb\",',\n//     '\\t\"version\" : 1,',\n//     '\\t\"protocolVersion\" : NumberLong(1),',\n//     '\\t\"members\" : [',\n//     '\\t\\t{',\n//     '\\t\\t\\t\"_id\" : 0,',\n//     '\\t\\t\\t\"host\" : \"mongodb1:27017\",',\n//     '\\t\\t\\t\"arbiterOnly\" : false,',\n//     '\\t\\t\\t\"buildIndexes\" : true,',\n//     '\\t\\t\\t\"hidden\" : false,',\n//     '\\t\\t\\t\"priority\" : 1,',\n//     '\\t\\t\\t\"tags\" : {',\n//     '\\t\\t\\t\\t',\n//     '\\t\\t\\t},',\n//     '\\t\\t\\t\"slaveDelay\" : NumberLong(0),',\n//     '\\t\\t\\t\"votes\" : 1',\n//     '\\t\\t}',\n//     '\\t],',\n//     '\\t\"settings\" : {',\n//     '\\t\\t\"chainingAllowed\" : true,',\n//     '\\t\\t\"heartbeatIntervalMillis\" : 2000,',\n//     '\\t\\t\"heartbeatTimeoutSecs\" : 10,',\n//     '\\t\\t\"electionTimeoutMillis\" : 10000,',\n//     '\\t\\t\"getLastErrorModes\" : {',\n//     '\\t\\t\\t',\n//     '\\t\\t},',\n//     '\\t\\t\"getLastErrorDefaults\" : {',\n//     '\\t\\t\\t\"w\" : 1,',\n//     '\\t\\t\\t\"wtimeout\" : 0',\n//     '\\t\\t}',\n//     '\\t}',\n//     '}',\n//     ''],\n//  object:\n//   {\n//     _id: 'mongodb',\n//     version: 1,\n//     protocolVersion: { '$numberLong': '1),' },\n//     members:\n//      [{\n//        _id: 0,\n//        host: 'mongodb1:27017',\n//        arbiterOnly: false,\n//        buildIndexes: true,\n//        hidden: false,\n//        priority: 1,\n//        tags: {},\n//        slaveDelay: { '$numberLong': '0),' },\n//        votes: 1\n//      }],\n//     settings:\n//      {\n//        chainingAllowed: true,\n//        heartbeatIntervalMillis: 2000,\n//        heartbeatTimeoutSecs: 10,\n//        electionTimeoutMillis: 10000,\n//        getLastErrorModes: {},\n//        getLastErrorDefaults: { w: 1, wtimeout: 0 }\n//      }\n//   }\n//}\n```\n\n* rs.add()\n\n```js\n\nmongo.command('rs.add(\\'mongodb2:27017\\')').then(function (data) {\n  console.log('data = ', data); \n});\n\n//data = {\n//  command: 'mongo --host localhost --port 27017  --eval \"rs.add(\\'mongodb2:27017\\')\"',\n//  raw: 'MongoDB shell version: 3.2.0\\\\nconnecting to: localhost:27017/test\\\\n{ \\\\\"ok\\\\\" : 1 }\\\\n',\n//  lines:\n//   ['MongoDB shell version: 3.2.0',\n//     'connecting to: localhost:27017/test',\n//     '{ \"ok\" : 1 }',\n//     ''],\n//  object: { ok: 1 }\n//}\n\n```\n\n\n* rs.status()\n\n```js\n\nmongo.command('rs.status()').then(function (data) {\n  console.log('data = ', data); \n});\n\n\n//data = {\n//  command: 'mongo --host localhost --port 27017  --eval \"rs.status()\"',\n//  raw: 'MongoDB shell version: 3.2.0\\\\nconnecting to: localhost:27017/test\\\\n{\\\\n\\\\t\\\\\"set\\\\\" : \\\\\"mongodb\\\\\",\\\\n\\\\t\\\\\"date\\\\\" : ISODate(\\\\\"2015-12-25T07:03:18.365Z\\\\\"),\\\\n\\\\t\\\\\"myState\\\\\" : 1,\\\\n\\\\t\\\\\"term\\\\\" : NumberLong(1),\\\\n\\\\t\\\\\"heartbeatIntervalMillis\\\\\" : NumberLong(2000),\\\\n\\\\t\\\\\"members\\\\\" : [\\\\n\\\\t\\\\t{\\\\n\\\\t\\\\t\\\\t\\\\\"_id\\\\\" : 0,\\\\n\\\\t\\\\t\\\\t\\\\\"name\\\\\" : \\\\\"mongodb1:27017\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"health\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"state\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"stateStr\\\\\" : \\\\\"PRIMARY\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"uptime\\\\\" : 4872,\\\\n\\\\t\\\\t\\\\t\\\\\"optime\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\\"ts\\\\\" : Timestamp(1451023102, 1),\\\\n\\\\t\\\\t\\\\t\\\\t\\\\\"t\\\\\" : NumberLong(1)\\\\n\\\\t\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\t\\\\\"optimeDate\\\\\" : ISODate(\\\\\"2015-12-25T05:58:22Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"electionTime\\\\\" : Timestamp(1451022242, 2),\\\\n\\\\t\\\\t\\\\t\\\\\"electionDate\\\\\" : ISODate(\\\\\"2015-12-25T05:44:02Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"configVersion\\\\\" : 3,\\\\n\\\\t\\\\t\\\\t\\\\\"self\\\\\" : true\\\\n\\\\t\\\\t},\\\\n\\\\t\\\\t{\\\\n\\\\t\\\\t\\\\t\\\\\"_id\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"name\\\\\" : \\\\\"mongodb2:27017\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"health\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"state\\\\\" : 2,\\\\n\\\\t\\\\t\\\\t\\\\\"stateStr\\\\\" : \\\\\"SECONDARY\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"uptime\\\\\" : 4700,\\\\n\\\\t\\\\t\\\\t\\\\\"optime\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\\"ts\\\\\" : Timestamp(1451023102, 1),\\\\n\\\\t\\\\t\\\\t\\\\t\\\\\"t\\\\\" : NumberLong(1)\\\\n\\\\t\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\t\\\\\"optimeDate\\\\\" : ISODate(\\\\\"2015-12-25T05:58:22Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"lastHeartbeat\\\\\" : ISODate(\\\\\"2015-12-25T07:03:17.273Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"lastHeartbeatRecv\\\\\" : ISODate(\\\\\"2015-12-25T07:03:17.601Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"pingMs\\\\\" : NumberLong(0),\\\\n\\\\t\\\\t\\\\t\\\\\"syncingTo\\\\\" : \\\\\"mongodb1:27017\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"configVersion\\\\\" : 3\\\\n\\\\t\\\\t},\\\\n\\\\t\\\\t{\\\\n\\\\t\\\\t\\\\t\\\\\"_id\\\\\" : 2,\\\\n\\\\t\\\\t\\\\t\\\\\"name\\\\\" : \\\\\"mongodb3:27017\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"health\\\\\" : 1,\\\\n\\\\t\\\\t\\\\t\\\\\"state\\\\\" : 2,\\\\n\\\\t\\\\t\\\\t\\\\\"stateStr\\\\\" : \\\\\"SECONDARY\\\\\",\\\\n\\\\t\\\\t\\\\t\\\\\"uptime\\\\\" : 3896,\\\\n\\\\t\\\\t\\\\t\\\\\"optime\\\\\" : {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\\"ts\\\\\" : Timestamp(1451023102, 1),\\\\n\\\\t\\\\t\\\\t\\\\t\\\\\"t\\\\\" : NumberLong(1)\\\\n\\\\t\\\\t\\\\t},\\\\n\\\\t\\\\t\\\\t\\\\\"optimeDate\\\\\" : ISODate(\\\\\"2015-12-25T05:58:22Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"lastHeartbeat\\\\\" : ISODate(\\\\\"2015-12-25T07:03:17.273Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"lastHeartbeatRecv\\\\\" : ISODate(\\\\\"2015-12-25T07:03:14.084Z\\\\\"),\\\\n\\\\t\\\\t\\\\t\\\\\"pingMs\\\\\" : NumberLong(0),\\\\n\\\\t\\\\t\\\\t\\\\\"configVersion\\\\\" : 3\\\\n\\\\t\\\\t}\\\\n\\\\t],\\\\n\\\\t\\\\\"ok\\\\\" : 1\\\\n}\\\\n',\n//  lines:\n//   ['MongoDB shell version: 3.2.0',\n//     'connecting to: localhost:27017/test',\n//     '{',\n//     '\\t\"set\" : \"mongodb\",',\n//     '\\t\"date\" : ISODate(\"2015-12-25T07:03:18.365Z\"),',\n//     '\\t\"myState\" : 1,',\n//     '\\t\"term\" : NumberLong(1),',\n//     '\\t\"heartbeatIntervalMillis\" : NumberLong(2000),',\n//     '\\t\"members\" : [',\n//     '\\t\\t{',\n//     '\\t\\t\\t\"_id\" : 0,',\n//     '\\t\\t\\t\"name\" : \"mongodb1:27017\",',\n//     '\\t\\t\\t\"health\" : 1,',\n//     '\\t\\t\\t\"state\" : 1,',\n//     '\\t\\t\\t\"stateStr\" : \"PRIMARY\",',\n//     '\\t\\t\\t\"uptime\" : 4872,',\n//     '\\t\\t\\t\"optime\" : {',\n//     '\\t\\t\\t\\t\"ts\" : Timestamp(1451023102, 1),',\n//     '\\t\\t\\t\\t\"t\" : NumberLong(1)',\n//     '\\t\\t\\t},',\n//     '\\t\\t\\t\"optimeDate\" : ISODate(\"2015-12-25T05:58:22Z\"),',\n//     '\\t\\t\\t\"electionTime\" : Timestamp(1451022242, 2),',\n//     '\\t\\t\\t\"electionDate\" : ISODate(\"2015-12-25T05:44:02Z\"),',\n//     '\\t\\t\\t\"configVersion\" : 3,',\n//     '\\t\\t\\t\"self\" : true',\n//     '\\t\\t},',\n//     '\\t\\t{',\n//     '\\t\\t\\t\"_id\" : 1,',\n//     '\\t\\t\\t\"name\" : \"mongodb2:27017\",',\n//     '\\t\\t\\t\"health\" : 1,',\n//     '\\t\\t\\t\"state\" : 2,',\n//     '\\t\\t\\t\"stateStr\" : \"SECONDARY\",',\n//     '\\t\\t\\t\"uptime\" : 4700,',\n//     '\\t\\t\\t\"optime\" : {',\n//     '\\t\\t\\t\\t\"ts\" : Timestamp(1451023102, 1),',\n//     '\\t\\t\\t\\t\"t\" : NumberLong(1)',\n//     '\\t\\t\\t},',\n//     '\\t\\t\\t\"optimeDate\" : ISODate(\"2015-12-25T05:58:22Z\"),',\n//     '\\t\\t\\t\"lastHeartbeat\" : ISODate(\"2015-12-25T07:03:17.273Z\"),',\n//     '\\t\\t\\t\"lastHeartbeatRecv\" : ISODate(\"2015-12-25T07:03:17.601Z\"),',\n//     '\\t\\t\\t\"pingMs\" : NumberLong(0),',\n//     '\\t\\t\\t\"syncingTo\" : \"mongodb1:27017\",',\n//     '\\t\\t\\t\"configVersion\" : 3',\n//     '\\t\\t},',\n//     '\\t\\t{',\n//     '\\t\\t\\t\"_id\" : 2,',\n//     '\\t\\t\\t\"name\" : \"mongodb3:27017\",',\n//     '\\t\\t\\t\"health\" : 1,',\n//     '\\t\\t\\t\"state\" : 2,',\n//     '\\t\\t\\t\"stateStr\" : \"SECONDARY\",',\n//     '\\t\\t\\t\"uptime\" : 3896,',\n//     '\\t\\t\\t\"optime\" : {',\n//     '\\t\\t\\t\\t\"ts\" : Timestamp(1451023102, 1),',\n//     '\\t\\t\\t\\t\"t\" : NumberLong(1)',\n//     '\\t\\t\\t},',\n//     '\\t\\t\\t\"optimeDate\" : ISODate(\"2015-12-25T05:58:22Z\"),',\n//     '\\t\\t\\t\"lastHeartbeat\" : ISODate(\"2015-12-25T07:03:17.273Z\"),',\n//     '\\t\\t\\t\"lastHeartbeatRecv\" : ISODate(\"2015-12-25T07:03:14.084Z\"),',\n//     '\\t\\t\\t\"pingMs\" : NumberLong(0),',\n//     '\\t\\t\\t\"configVersion\" : 3',\n//     '\\t\\t}',\n//     '\\t],',\n//     '\\t\"ok\" : 1',\n//     '}',\n//     ''],\n//  object:\n//   {\n//     set: 'mongodb',\n//     date: { '$date': '2015-12-25T07:03:18.365Z' },\n//     myState: 1,\n//     term: { '$numberLong': '1' },\n//     heartbeatIntervalMillis: { '$numberLong': '2000' },\n//     members:\n//      [{\n//        _id: 0,\n//        name: 'mongodb1:27017',\n//        health: 1,\n//        state: 1,\n//        stateStr: 'PRIMARY',\n//        uptime: 4872,\n//        optime:\n//         {\n//           ts: { '$timestamp': { t: 1451023102, i: 1 } },\n//           t: { '$numberLong': '1' }\n//         },\n//        optimeDate: { '$date': '2015-12-25T05:58:22Z' },\n//        electionTime: { '$timestamp': { t: 1451022242, i: 2 } },\n//        electionDate: { '$date': '2015-12-25T05:44:02Z' },\n//        configVersion: 3,\n//        self: true\n//      },\n//        {\n//          _id: 1,\n//          name: 'mongodb2:27017',\n//          health: 1,\n//          state: 2,\n//          stateStr: 'SECONDARY',\n//          uptime: 4700,\n//          optime:\n//           {\n//             ts: { '$timestamp': { t: 1451023102, i: 1 } },\n//             t: { '$numberLong': '1' }\n//           },\n//          optimeDate: { '$date': '2015-12-25T05:58:22Z' },\n//          lastHeartbeat: { '$date': '2015-12-25T07:03:17.273Z' },\n//          lastHeartbeatRecv: { '$date': '2015-12-25T07:03:17.601Z' },\n//          pingMs: { '$numberLong': '0' },\n//          syncingTo: 'mongodb1:27017',\n//          configVersion: 3\n//        },\n//        {\n//          _id: 2,\n//          name: 'mongodb3:27017',\n//          health: 1,\n//          state: 2,\n//          stateStr: 'SECONDARY',\n//          uptime: 3896,\n//          optime:\n//           {\n//             ts: { '$timestamp': { t: 1451023102, i: 1 } },\n//             t: { '$numberLong': '1' }\n//           },\n//          optimeDate: { '$date': '2015-12-25T05:58:22Z' },\n//          lastHeartbeat: { '$date': '2015-12-25T07:03:17.273Z' },\n//          lastHeartbeatRecv: { '$date': '2015-12-25T07:03:14.084Z' },\n//          pingMs: { '$numberLong': '0' },\n//          configVersion: 3\n//        }],\n//     ok: 1\n//   }\n//}\n```\n\n## License\n\nMIT\n\n[npm-image]: https://img.shields.io/npm/v/mongo-cli-js.svg?style=flat\n[npm-url]: https://npmjs.org/package/mongo-cli-js\n[downloads-image]: https://img.shields.io/npm/dm/mongo-cli-js.svg?style=flat\n[downloads-url]: https://npmjs.org/package/mongo-cli-js\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquobject%2Fmongo-cli-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquobject%2Fmongo-cli-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquobject%2Fmongo-cli-js/lists"}