@@ -59,6 +59,7 @@ class Topology extends EventEmitter {
5959 : TopologyType . Unknown ;
6060
6161 const topologyId = globalTopologyCounter ++ ;
62+
6263 const serverDescriptions = seedlist . reduce ( ( result , seed ) => {
6364 const address = seed . port ? `${ seed . host } :${ seed . port } ` : `${ seed . host } :27017` ;
6465 result . set ( address , new ServerDescription ( address ) ) ;
@@ -114,7 +115,7 @@ class Topology extends EventEmitter {
114115 )
115116 ) ;
116117
117- // emit ServerOpeningEvents for each server in our topology
118+ // emit `ServerOpeningEvent`s for each server in our topology
118119 Array . from ( this . s . description . servers . keys ( ) ) . forEach ( serverAddress => {
119120 // publish an open event for each ServerDescription created
120121 this . emit ( 'serverOpening' , new monitoring . ServerOpeningEvent ( this . s . id , serverAddress ) ) ;
@@ -160,7 +161,7 @@ class Topology extends EventEmitter {
160161 *
161162 * @param {object } serverDescription The server to update in the internal list of server descriptions
162163 */
163- update ( serverDescription ) {
164+ serverUpdateHandler ( serverDescription ) {
164165 // these will be used for monitoring events later
165166 const previousTopologyDescription = this . s . description ;
166167 const previousServerDescription = this . s . description . servers . get ( serverDescription . address ) ;
@@ -188,6 +189,119 @@ class Topology extends EventEmitter {
188189 )
189190 ) ;
190191 }
192+
193+ /**
194+ * Authenticate using a specified mechanism
195+ *
196+ * @param {String } mechanism The auth mechanism used for authentication
197+ * @param {String } db The db we are authenticating against
198+ * @param {Object } options Optional settings for the authenticating mechanism
199+ * @param {authResultCallback } callback A callback function
200+ */
201+ auth ( mechanism , db , options , callback ) {
202+ callback ( null , null ) ;
203+ }
204+
205+ /**
206+ * Logout from a database
207+ *
208+ * @param {String } db The db we are logging out from
209+ * @param {authResultCallback } callback A callback function
210+ */
211+ logout ( db , callback ) {
212+ callback ( null , null ) ;
213+ }
214+
215+ // Basic operation support. Eventually this should be moved into command construction
216+ // during the command refactor.
217+
218+ /**
219+ * Insert one or more documents
220+ *
221+ * @param {String } ns The full qualified namespace for this operation
222+ * @param {Array } ops An array of documents to insert
223+ * @param {Boolean } [options.ordered=true] Execute in order or out of order
224+ * @param {Object } [options.writeConcern] Write concern for the operation
225+ * @param {Boolean } [options.serializeFunctions=false] Specify if functions on an object should be serialized
226+ * @param {Boolean } [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields
227+ * @param {ClientSession } [options.session] Session to use for the operation
228+ * @param {boolean } [options.retryWrites] Enable retryable writes for this operation
229+ * @param {opResultCallback } callback A callback function
230+ */
231+ insert ( ns , ops , options , callback ) {
232+ callback ( null , null ) ;
233+ }
234+
235+ /**
236+ * Perform one or more update operations
237+ *
238+ * @param {string } ns The fully qualified namespace for this operation
239+ * @param {array } ops An array of updates
240+ * @param {boolean } [options.ordered=true] Execute in order or out of order
241+ * @param {object } [options.writeConcern] Write concern for the operation
242+ * @param {Boolean } [options.serializeFunctions=false] Specify if functions on an object should be serialized
243+ * @param {Boolean } [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields
244+ * @param {ClientSession } [options.session] Session to use for the operation
245+ * @param {boolean } [options.retryWrites] Enable retryable writes for this operation
246+ * @param {opResultCallback } callback A callback function
247+ */
248+ update ( ns , ops , options , callback ) {
249+ callback ( null , null ) ;
250+ }
251+
252+ /**
253+ * Perform one or more remove operations
254+ *
255+ * @param {string } ns The MongoDB fully qualified namespace (ex: db1.collection1)
256+ * @param {array } ops An array of removes
257+ * @param {boolean } [options.ordered=true] Execute in order or out of order
258+ * @param {object } [options.writeConcern={}] Write concern for the operation
259+ * @param {Boolean } [options.serializeFunctions=false] Specify if functions on an object should be serialized.
260+ * @param {Boolean } [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields.
261+ * @param {ClientSession } [options.session=null] Session to use for the operation
262+ * @param {boolean } [options.retryWrites] Enable retryable writes for this operation
263+ * @param {opResultCallback } callback A callback function
264+ */
265+ remove ( ns , ops , options , callback ) {
266+ callback ( null , null ) ;
267+ }
268+
269+ /**
270+ * Execute a command
271+ *
272+ * @method
273+ * @param {string } ns The MongoDB fully qualified namespace (ex: db1.collection1)
274+ * @param {object } cmd The command hash
275+ * @param {ReadPreference } [options.readPreference] Specify read preference if command supports it
276+ * @param {Connection } [options.connection] Specify connection object to execute command against
277+ * @param {Boolean } [options.serializeFunctions=false] Specify if functions on an object should be serialized.
278+ * @param {Boolean } [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields.
279+ * @param {ClientSession } [options.session=null] Session to use for the operation
280+ * @param {opResultCallback } callback A callback function
281+ */
282+ command ( ns , cmd , options , callback ) {
283+ callback ( null , null ) ;
284+ }
285+
286+ /**
287+ * Create a new cursor
288+ *
289+ * @method
290+ * @param {string } ns The MongoDB fully qualified namespace (ex: db1.collection1)
291+ * @param {object|Long } cmd Can be either a command returning a cursor or a cursorId
292+ * @param {object } [options] Options for the cursor
293+ * @param {object } [options.batchSize=0] Batchsize for the operation
294+ * @param {array } [options.documents=[]] Initial documents list for cursor
295+ * @param {ReadPreference } [options.readPreference] Specify read preference if command supports it
296+ * @param {Boolean } [options.serializeFunctions=false] Specify if functions on an object should be serialized.
297+ * @param {Boolean } [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields.
298+ * @param {ClientSession } [options.session=null] Session to use for the operation
299+ * @param {object } [options.topology] The internal topology of the created cursor
300+ * @returns {Cursor }
301+ */
302+ cursor ( /* ns, cmd, options */ ) {
303+ //
304+ }
191305}
192306
193307function randomSelection ( array ) {
0 commit comments