@@ -93,7 +93,7 @@ mongo.command('rs.conf()').then(function (data) {
9393
9494// data = {
9595// command: 'mongo --host localhost --port 27017 --eval "rs.conf();"',
96- // 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.quobject.io :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",""]',
96+ // 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",""]',
9797// lines:
9898// ['MongoDB shell version: 3.2.0',
9999// 'connecting to: localhost:27017/test',
@@ -104,7 +104,7 @@ mongo.command('rs.conf()').then(function (data) {
104104// '\t"members" : [',
105105// '\t\t{',
106106// '\t\t\t"_id" : 0,',
107- // '\t\t\t"host" : "mongodb1.quobject.io :27017",',
107+ // '\t\t\t"host" : "mongodb1:27017",',
108108// '\t\t\t"arbiterOnly" : false,',
109109// '\t\t\t"buildIndexes" : true,',
110110// '\t\t\t"hidden" : false,',
@@ -139,7 +139,7 @@ mongo.command('rs.conf()').then(function (data) {
139139// members:
140140// [{
141141// _id: 0,
142- // host: 'mongodb1.quobject.io :27017',
142+ // host: 'mongodb1:27017',
143143// arbiterOnly: false,
144144// buildIndexes: true,
145145// hidden: false,
@@ -172,13 +172,13 @@ mongo.command('rs.initiate()').then(function (data) {
172172
173173// data = {
174174// command: 'mongo --host localhost --port 27017 --eval "rs.initiate()"',
175- // 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.quobject.io :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",""]',
175+ // 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",""]',
176176// lines:
177177// ['MongoDB shell version: 3.2.0',
178178// 'connecting to: localhost:27017/test',
179179// '{',
180180// '\t"info2" : "no configuration specified. Using a default configuration for the set",',
181- // '\t"me" : "mongodb1.quobject.io :27017",',
181+ // '\t"me" : "mongodb1:27017",',
182182// '\t"info" : "try querying local.system.replset to see current configuration",',
183183// '\t"ok" : 0,',
184184// '\t"errmsg" : "already initialized",',
@@ -188,11 +188,112 @@ mongo.command('rs.initiate()').then(function (data) {
188188// object:
189189// {
190190// info2: 'no configuration specified. Using a default configuration for the set',
191- // me: 'mongodb1.quobject.io :27017',
191+ // me: 'mongodb1:27017',
192192// info: 'try querying local.system.replset to see current configuration',
193193// ok: 0,
194194// errmsg: 'already initialized',
195195// code: 23
196196// }
197197// }
198- ```
198+ ```
199+
200+
201+ * rs.conf()
202+
203+ ``` js
204+
205+ mongo .command (' rs.conf()' ).then (function (data ) {
206+ console .log (' data = ' , data);
207+ });
208+
209+
210+ // data = {
211+ // command: 'mongo --host localhost --port 27017 --eval "rs.conf();"',
212+ // 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",""]',
213+ // lines:
214+ // ['MongoDB shell version: 3.2.0',
215+ // 'connecting to: localhost:27017/test',
216+ // '{',
217+ // '\t"_id" : "mongodb",',
218+ // '\t"version" : 1,',
219+ // '\t"protocolVersion" : NumberLong(1),',
220+ // '\t"members" : [',
221+ // '\t\t{',
222+ // '\t\t\t"_id" : 0,',
223+ // '\t\t\t"host" : "mongodb1:27017",',
224+ // '\t\t\t"arbiterOnly" : false,',
225+ // '\t\t\t"buildIndexes" : true,',
226+ // '\t\t\t"hidden" : false,',
227+ // '\t\t\t"priority" : 1,',
228+ // '\t\t\t"tags" : {',
229+ // '\t\t\t\t',
230+ // '\t\t\t},',
231+ // '\t\t\t"slaveDelay" : NumberLong(0),',
232+ // '\t\t\t"votes" : 1',
233+ // '\t\t}',
234+ // '\t],',
235+ // '\t"settings" : {',
236+ // '\t\t"chainingAllowed" : true,',
237+ // '\t\t"heartbeatIntervalMillis" : 2000,',
238+ // '\t\t"heartbeatTimeoutSecs" : 10,',
239+ // '\t\t"electionTimeoutMillis" : 10000,',
240+ // '\t\t"getLastErrorModes" : {',
241+ // '\t\t\t',
242+ // '\t\t},',
243+ // '\t\t"getLastErrorDefaults" : {',
244+ // '\t\t\t"w" : 1,',
245+ // '\t\t\t"wtimeout" : 0',
246+ // '\t\t}',
247+ // '\t}',
248+ // '}',
249+ // ''],
250+ // object:
251+ // {
252+ // _id: 'mongodb',
253+ // version: 1,
254+ // protocolVersion: { '$numberLong': '1),' },
255+ // members:
256+ // [{
257+ // _id: 0,
258+ // host: 'mongodb1:27017',
259+ // arbiterOnly: false,
260+ // buildIndexes: true,
261+ // hidden: false,
262+ // priority: 1,
263+ // tags: {},
264+ // slaveDelay: { '$numberLong': '0),' },
265+ // votes: 1
266+ // }],
267+ // settings:
268+ // {
269+ // chainingAllowed: true,
270+ // heartbeatIntervalMillis: 2000,
271+ // heartbeatTimeoutSecs: 10,
272+ // electionTimeoutMillis: 10000,
273+ // getLastErrorModes: {},
274+ // getLastErrorDefaults: { w: 1, wtimeout: 0 }
275+ // }
276+ // }
277+ // }
278+ ```
279+
280+ * rs.add()
281+
282+ ``` js
283+
284+ mongo .command (' rs.add(\' mongodb2:27017\' )' ).then (function (data ) {
285+ console .log (' data = ' , data);
286+ });
287+
288+ // data = {
289+ // command: 'mongo --host localhost --port 27017 --eval "rs.add(\'mongodb2:27017\')"',
290+ // raw: '["MongoDB shell version: 3.2.0\\nconnecting to: localhost:27017/test\\n{ \\"ok\\" : 1 }\\n",""]',
291+ // lines:
292+ // ['MongoDB shell version: 3.2.0',
293+ // 'connecting to: localhost:27017/test',
294+ // '{ "ok" : 1 }',
295+ // ''],
296+ // object: { ok: 1 }
297+ // }
298+
299+ ```
0 commit comments