@@ -11,7 +11,7 @@ const ListDatabasesOperation = require('./operations/list_databases');
11
11
const executeOperation = require ( './operations/execute_operation' ) ;
12
12
13
13
/**
14
- * @fileOverview The **Admin** class is an internal class that allows convenient access to
14
+ * @file The **Admin** class is an internal class that allows convenient access to
15
15
* the admin functionality and commands for MongoDB.
16
16
*
17
17
* **ADMIN Cannot directly be instantiated**
@@ -39,8 +39,12 @@ const executeOperation = require('./operations/execute_operation');
39
39
40
40
/**
41
41
* Create a new Admin instance (INTERNAL TYPE, do not instantiate directly)
42
+ *
42
43
* @class
43
- * @return {Admin } a collection instance.
44
+ * @returns {Admin } a collection instance.
45
+ * @param {any } db
46
+ * @param {any } topology
47
+ * @param {any } promiseLibrary
44
48
*/
45
49
function Admin ( db , topology , promiseLibrary ) {
46
50
if ( ! ( this instanceof Admin ) ) return new Admin ( db , topology ) ;
@@ -55,20 +59,22 @@ function Admin(db, topology, promiseLibrary) {
55
59
56
60
/**
57
61
* The callback format for results
62
+ *
58
63
* @callback Admin~resultCallback
59
64
* @param {MongoError } error An error instance representing the error during the execution.
60
65
* @param {object } result The result object if the command was executed successfully.
61
66
*/
62
67
63
68
/**
64
69
* Execute a command
65
- * @method
70
+ *
71
+ * @function
66
72
* @param {object } command The command hash
67
73
* @param {object } [options] Optional settings.
68
74
* @param {(ReadPreference|string) } [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
69
75
* @param {number } [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
70
76
* @param {Admin~resultCallback } [callback] The command result callback
71
- * @return {Promise } returns Promise if no callback passed
77
+ * @returns {Promise } returns Promise if no callback passed
72
78
*/
73
79
Admin . prototype . command = function ( command , options , callback ) {
74
80
const args = Array . prototype . slice . call ( arguments , 1 ) ;
@@ -84,10 +90,10 @@ Admin.prototype.command = function(command, options, callback) {
84
90
* Retrieve the server information for the current
85
91
* instance of the db client
86
92
*
87
- * @param {Object } [options] optional parameters for this operation
93
+ * @param {object } [options] optional parameters for this operation
88
94
* @param {ClientSession } [options.session] optional session to use for this operation
89
95
* @param {Admin~resultCallback } [callback] The command result callback
90
- * @return {Promise } returns Promise if no callback passed
96
+ * @returns {Promise } returns Promise if no callback passed
91
97
*/
92
98
Admin . prototype . buildInfo = function ( options , callback ) {
93
99
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -104,10 +110,10 @@ Admin.prototype.buildInfo = function(options, callback) {
104
110
* Retrieve the server information for the current
105
111
* instance of the db client
106
112
*
107
- * @param {Object } [options] optional parameters for this operation
113
+ * @param {object } [options] optional parameters for this operation
108
114
* @param {ClientSession } [options.session] optional session to use for this operation
109
115
* @param {Admin~resultCallback } [callback] The command result callback
110
- * @return {Promise } returns Promise if no callback passed
116
+ * @returns {Promise } returns Promise if no callback passed
111
117
*/
112
118
Admin . prototype . serverInfo = function ( options , callback ) {
113
119
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -123,10 +129,10 @@ Admin.prototype.serverInfo = function(options, callback) {
123
129
/**
124
130
* Retrieve this db's server status.
125
131
*
126
- * @param {Object } [options] optional parameters for this operation
132
+ * @param {object } [options] optional parameters for this operation
127
133
* @param {ClientSession } [options.session] optional session to use for this operation
128
134
* @param {Admin~resultCallback } [callback] The command result callback
129
- * @return {Promise } returns Promise if no callback passed
135
+ * @returns {Promise } returns Promise if no callback passed
130
136
*/
131
137
Admin . prototype . serverStatus = function ( options , callback ) {
132
138
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -144,10 +150,10 @@ Admin.prototype.serverStatus = function(options, callback) {
144
150
/**
145
151
* Ping the MongoDB server and retrieve results
146
152
*
147
- * @param {Object } [options] optional parameters for this operation
153
+ * @param {object } [options] optional parameters for this operation
148
154
* @param {ClientSession } [options.session] optional session to use for this operation
149
155
* @param {Admin~resultCallback } [callback] The command result callback
150
- * @return {Promise } returns Promise if no callback passed
156
+ * @returns {Promise } returns Promise if no callback passed
151
157
*/
152
158
Admin . prototype . ping = function ( options , callback ) {
153
159
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -162,7 +168,8 @@ Admin.prototype.ping = function(options, callback) {
162
168
163
169
/**
164
170
* Add a user to the database.
165
- * @method
171
+ *
172
+ * @function
166
173
* @param {string } username The username.
167
174
* @param {string } password The password.
168
175
* @param {object } [options] Optional settings.
@@ -174,7 +181,7 @@ Admin.prototype.ping = function(options, callback) {
174
181
* @param {object[] } [options.roles] Roles associated with the created user (only Mongodb 2.6 or higher)
175
182
* @param {ClientSession } [options.session] optional session to use for this operation
176
183
* @param {Admin~resultCallback } [callback] The command result callback
177
- * @return {Promise } returns Promise if no callback passed
184
+ * @returns {Promise } returns Promise if no callback passed
178
185
*/
179
186
Admin . prototype . addUser = function ( username , password , options , callback ) {
180
187
const args = Array . prototype . slice . call ( arguments , 2 ) ;
@@ -200,7 +207,8 @@ Admin.prototype.addUser = function(username, password, options, callback) {
200
207
201
208
/**
202
209
* Remove a user from a database
203
- * @method
210
+ *
211
+ * @function
204
212
* @param {string } username The username.
205
213
* @param {object } [options] Optional settings.
206
214
* @param {(number|string) } [options.w] The write concern.
@@ -209,7 +217,7 @@ Admin.prototype.addUser = function(username, password, options, callback) {
209
217
* @param {boolean } [options.fsync=false] Specify a file sync write concern.
210
218
* @param {ClientSession } [options.session] optional session to use for this operation
211
219
* @param {Admin~resultCallback } [callback] The command result callback
212
- * @return {Promise } returns Promise if no callback passed
220
+ * @returns {Promise } returns Promise if no callback passed
213
221
*/
214
222
Admin . prototype . removeUser = function ( username , options , callback ) {
215
223
const args = Array . prototype . slice . call ( arguments , 1 ) ;
@@ -235,7 +243,7 @@ Admin.prototype.removeUser = function(username, options, callback) {
235
243
* @param {boolean } [options.background] Validates a collection in the background, without interrupting read or write traffic (only in MongoDB 4.4+)
236
244
* @param {ClientSession } [options.session] optional session to use for this operation
237
245
* @param {Admin~resultCallback } [callback] The command result callback.
238
- * @return {Promise } returns Promise if no callback passed
246
+ * @returns {Promise } returns Promise if no callback passed
239
247
*/
240
248
Admin . prototype . validateCollection = function ( collectionName , options , callback ) {
241
249
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -257,7 +265,7 @@ Admin.prototype.validateCollection = function(collectionName, options, callback)
257
265
* @param {boolean } [options.nameOnly=false] Whether the command should return only db names, or names and size info.
258
266
* @param {ClientSession } [options.session] optional session to use for this operation
259
267
* @param {Admin~resultCallback } [callback] The command result callback.
260
- * @return {Promise } returns Promise if no callback passed
268
+ * @returns {Promise } returns Promise if no callback passed
261
269
*/
262
270
Admin . prototype . listDatabases = function ( options , callback ) {
263
271
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -273,10 +281,10 @@ Admin.prototype.listDatabases = function(options, callback) {
273
281
/**
274
282
* Get ReplicaSet status
275
283
*
276
- * @param {Object } [options] optional parameters for this operation
284
+ * @param {object } [options] optional parameters for this operation
277
285
* @param {ClientSession } [options.session] optional session to use for this operation
278
286
* @param {Admin~resultCallback } [callback] The command result callback.
279
- * @return {Promise } returns Promise if no callback passed
287
+ * @returns {Promise } returns Promise if no callback passed
280
288
*/
281
289
Admin . prototype . replSetGetStatus = function ( options , callback ) {
282
290
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
0 commit comments