@@ -43,7 +43,7 @@ describe('APM', function () {
43
43
test : function ( ) {
44
44
const started = [ ] ;
45
45
const succeeded = [ ] ;
46
- const self = this ;
46
+
47
47
const client = this . configuration . newClient (
48
48
{ writeConcern : { w : 1 } } ,
49
49
{ maxPoolSize : 1 , monitorCommands : true }
@@ -52,7 +52,7 @@ describe('APM', function () {
52
52
client . on ( 'commandStarted' , filterForCommands ( 'insert' , started ) ) ;
53
53
client . on ( 'commandSucceeded' , filterForCommands ( 'insert' , succeeded ) ) ;
54
54
55
- const db = client . db ( self . configuration . db ) ;
55
+ const db = client . db ( this . configuration . db ) ;
56
56
const collection = db . collection ( 'apm_test_cursor' ) ;
57
57
return collection . insertMany ( [ { a : 1 } , { a : 2 } , { a : 3 } ] ) . then ( r => {
58
58
expect ( r ) . property ( 'insertedCount' ) . to . equal ( 3 ) ;
@@ -69,22 +69,21 @@ describe('APM', function () {
69
69
metadata : { requires : { topology : [ 'replicaset' ] , mongodb : '>=3.0.0' } } ,
70
70
71
71
test : function ( ) {
72
- const self = this ;
73
72
const started = [ ] ;
74
73
const succeeded = [ ] ;
75
- const client = self . configuration . newClient (
74
+ const client = this . configuration . newClient (
76
75
{ writeConcern : { w : 1 } } ,
77
76
{ maxPoolSize : 1 , monitorCommands : true }
78
77
) ;
79
78
80
79
client . on ( 'commandStarted' , filterForCommands ( 'listCollections' , started ) ) ;
81
80
client . on ( 'commandSucceeded' , filterForCommands ( 'listCollections' , succeeded ) ) ;
82
81
83
- const db = client . db ( self . configuration . db ) ;
82
+ const db = client . db ( this . configuration . db ) ;
84
83
85
84
return db
86
85
. collection ( 'apm_test_list_collections' )
87
- . insertOne ( { a : 1 } , self . configuration . writeConcernMax ( ) )
86
+ . insertOne ( { a : 1 } , this . configuration . writeConcernMax ( ) )
88
87
. then ( r => {
89
88
expect ( r ) . property ( 'insertedId' ) . to . exist ;
90
89
return db . listCollections ( { } , { readPreference : ReadPreference . primary } ) . toArray ( ) ;
@@ -104,10 +103,9 @@ describe('APM', function () {
104
103
metadata : { requires : { topology : [ 'replicaset' ] , mongodb : '>=3.0.0' } } ,
105
104
106
105
test : function ( ) {
107
- const self = this ;
108
106
const started = [ ] ;
109
107
const succeeded = [ ] ;
110
- const client = self . configuration . newClient (
108
+ const client = this . configuration . newClient (
111
109
{ writeConcern : { w : 1 } } ,
112
110
{ maxPoolSize : 1 , monitorCommands : true }
113
111
) ;
@@ -116,11 +114,11 @@ describe('APM', function () {
116
114
client . on ( 'commandStarted' , filterForCommands ( desiredEvents , started ) ) ;
117
115
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
118
116
119
- const db = client . db ( self . configuration . db ) ;
117
+ const db = client . db ( this . configuration . db ) ;
120
118
121
119
return db
122
120
. collection ( 'apm_test_list_collections' )
123
- . insertOne ( { a : 1 } , self . configuration . writeConcernMax ( ) )
121
+ . insertOne ( { a : 1 } , this . configuration . writeConcernMax ( ) )
124
122
. then ( r => {
125
123
expect ( r ) . property ( 'insertedId' ) . to . exist ;
126
124
@@ -148,11 +146,10 @@ describe('APM', function () {
148
146
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
149
147
150
148
test : function ( ) {
151
- const self = this ;
152
149
const started = [ ] ;
153
150
const succeeded = [ ] ;
154
151
const failed = [ ] ;
155
- const client = self . configuration . newClient (
152
+ const client = this . configuration . newClient (
156
153
{ writeConcern : { w : 1 } } ,
157
154
{ maxPoolSize : 1 , monitorCommands : true }
158
155
) ;
@@ -162,7 +159,7 @@ describe('APM', function () {
162
159
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
163
160
client . on ( 'commandFailed' , filterForCommands ( desiredEvents , failed ) ) ;
164
161
165
- const db = client . db ( self . configuration . db ) ;
162
+ const db = client . db ( this . configuration . db ) ;
166
163
167
164
// Drop the collection
168
165
return db
@@ -220,11 +217,10 @@ describe('APM', function () {
220
217
metadata : { requires : { topology : [ 'single' , 'replicaset' ] , mongodb : '>=2.6.0' } } ,
221
218
222
219
test : function ( ) {
223
- const self = this ;
224
220
const started = [ ] ;
225
221
const succeeded = [ ] ;
226
222
const failed = [ ] ;
227
- const client = self . configuration . newClient (
223
+ const client = this . configuration . newClient (
228
224
{ writeConcern : { w : 1 } } ,
229
225
{ maxPoolSize : 1 , monitorCommands : true }
230
226
) ;
@@ -234,7 +230,7 @@ describe('APM', function () {
234
230
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
235
231
client . on ( 'commandFailed' , filterForCommands ( desiredEvents , failed ) ) ;
236
232
237
- const db = client . db ( self . configuration . db ) ;
233
+ const db = client . db ( this . configuration . db ) ;
238
234
239
235
// Drop the collection
240
236
return db
@@ -277,10 +273,9 @@ describe('APM', function () {
277
273
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
278
274
279
275
test : function ( ) {
280
- const self = this ;
281
276
const started = [ ] ;
282
277
const succeeded = [ ] ;
283
- const client = self . configuration . newClient (
278
+ const client = this . configuration . newClient (
284
279
{ writeConcern : { w : 1 } } ,
285
280
{ maxPoolSize : 1 , monitorCommands : true }
286
281
) ;
@@ -289,7 +284,7 @@ describe('APM', function () {
289
284
client . on ( 'commandStarted' , filterForCommands ( desiredEvents , started ) ) ;
290
285
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
291
286
292
- const db = client . db ( self . configuration . db ) ;
287
+ const db = client . db ( this . configuration . db ) ;
293
288
return db
294
289
. collection ( 'apm_test_3' )
295
290
. bulkWrite (
@@ -316,11 +311,10 @@ describe('APM', function () {
316
311
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
317
312
318
313
test : function ( ) {
319
- const self = this ;
320
314
const started = [ ] ;
321
315
const succeeded = [ ] ;
322
316
const failed = [ ] ;
323
- const client = self . configuration . newClient (
317
+ const client = this . configuration . newClient (
324
318
{ writeConcern : { w : 1 } } ,
325
319
{ maxPoolSize : 1 , monitorCommands : true }
326
320
) ;
@@ -330,7 +324,7 @@ describe('APM', function () {
330
324
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
331
325
client . on ( 'commandFailed' , filterForCommands ( desiredEvents , failed ) ) ;
332
326
333
- const db = client . db ( self . configuration . db ) ;
327
+ const db = client . db ( this . configuration . db ) ;
334
328
335
329
return db
336
330
. collection ( 'apm_test_2' )
@@ -364,11 +358,10 @@ describe('APM', function () {
364
358
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
365
359
366
360
test : function ( ) {
367
- const self = this ;
368
361
const started = [ ] ;
369
362
const succeeded = [ ] ;
370
363
const failed = [ ] ;
371
- const client = self . configuration . newClient (
364
+ const client = this . configuration . newClient (
372
365
{ writeConcern : { w : 1 } } ,
373
366
{ maxPoolSize : 1 , monitorCommands : true }
374
367
) ;
@@ -379,7 +372,7 @@ describe('APM', function () {
379
372
client . on ( 'commandFailed' , filterForCommands ( desiredEvents , failed ) ) ;
380
373
381
374
return client
382
- . db ( self . configuration . db )
375
+ . db ( this . configuration . db )
383
376
. command ( { getnonce : true } )
384
377
. then ( r => {
385
378
expect ( r ) . to . exist ;
@@ -397,10 +390,9 @@ describe('APM', function () {
397
390
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
398
391
399
392
test : function ( ) {
400
- const self = this ;
401
393
const started = [ ] ;
402
394
const succeeded = [ ] ;
403
- const client = self . configuration . newClient (
395
+ const client = this . configuration . newClient (
404
396
{ writeConcern : { w : 1 } } ,
405
397
{ maxPoolSize : 1 , monitorCommands : true }
406
398
) ;
@@ -410,7 +402,7 @@ describe('APM', function () {
410
402
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
411
403
412
404
return client
413
- . db ( self . configuration . db )
405
+ . db ( this . configuration . db )
414
406
. collection ( 'apm_test_u_1' )
415
407
. updateOne ( { a : 1 } , { $set : { b : 1 } } , { upsert : true } )
416
408
. then ( r => {
@@ -428,10 +420,9 @@ describe('APM', function () {
428
420
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
429
421
430
422
test : function ( ) {
431
- const self = this ;
432
423
const started = [ ] ;
433
424
const succeeded = [ ] ;
434
- const client = self . configuration . newClient (
425
+ const client = this . configuration . newClient (
435
426
{ writeConcern : { w : 1 } } ,
436
427
{ maxPoolSize : 1 , monitorCommands : true }
437
428
) ;
@@ -441,7 +432,7 @@ describe('APM', function () {
441
432
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
442
433
443
434
return client
444
- . db ( self . configuration . db )
435
+ . db ( this . configuration . db )
445
436
. collection ( 'apm_test_u_2' )
446
437
. updateMany ( { a : 1 } , { $set : { b : 1 } } , { upsert : true } )
447
438
. then ( r => {
@@ -459,10 +450,9 @@ describe('APM', function () {
459
450
metadata : { requires : { topology : [ 'single' , 'replicaset' ] } } ,
460
451
461
452
test : function ( ) {
462
- const self = this ;
463
453
const started = [ ] ;
464
454
const succeeded = [ ] ;
465
- const client = self . configuration . newClient (
455
+ const client = this . configuration . newClient (
466
456
{ writeConcern : { w : 1 } } ,
467
457
{ maxPoolSize : 1 , monitorCommands : true }
468
458
) ;
@@ -472,7 +462,7 @@ describe('APM', function () {
472
462
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
473
463
474
464
return client
475
- . db ( self . configuration . db )
465
+ . db ( this . configuration . db )
476
466
. collection ( 'apm_test_u_3' )
477
467
. deleteOne ( { a : 1 } )
478
468
. then ( r => {
@@ -490,13 +480,12 @@ describe('APM', function () {
490
480
metadata : { requires : { topology : [ 'single' , 'replicaset' ] , mongodb : '<=3.0.x' } } ,
491
481
492
482
test : function ( ) {
493
- const self = this ;
494
- const client = self . configuration . newClient (
483
+ const client = this . configuration . newClient (
495
484
{ writeConcern : { w : 1 } } ,
496
485
{ maxPoolSize : 1 , monitorCommands : true }
497
486
) ;
498
487
499
- const db = client . db ( self . configuration . db ) ;
488
+ const db = client . db ( this . configuration . db ) ;
500
489
const admindb = db . admin ( ) ;
501
490
let cursorCountBefore ;
502
491
let cursorCountAfter ;
@@ -531,15 +520,14 @@ describe('APM', function () {
531
520
metadata : { requires : { topology : [ 'single' , 'replicaset' ] , mongodb : '>=3.0.0' } } ,
532
521
533
522
test : function ( ) {
534
- const self = this ;
535
523
const started = [ ] ;
536
524
const succeeded = [ ] ;
537
525
538
526
// Generate docs
539
527
const docs = [ ] ;
540
528
for ( let i = 0 ; i < 2500 ; i ++ ) docs . push ( { a : i } ) ;
541
529
542
- const client = self . configuration . newClient (
530
+ const client = this . configuration . newClient (
543
531
{ writeConcern : { w : 1 } } ,
544
532
{ maxPoolSize : 1 , monitorCommands : true }
545
533
) ;
@@ -548,7 +536,7 @@ describe('APM', function () {
548
536
client . on ( 'commandStarted' , filterForCommands ( desiredEvents , started ) ) ;
549
537
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
550
538
551
- const db = client . db ( self . configuration . db ) ;
539
+ const db = client . db ( this . configuration . db ) ;
552
540
return db
553
541
. collection ( 'apm_test_u_4' )
554
542
. drop ( )
@@ -580,10 +568,9 @@ describe('APM', function () {
580
568
it ( 'should correctly decorate the apm result for listCollections with cursorId' , {
581
569
metadata : { requires : { topology : [ 'single' , 'replicaset' ] , mongodb : '>=3.0.0' } } ,
582
570
test : function ( ) {
583
- const self = this ;
584
571
const started = [ ] ;
585
572
const succeeded = [ ] ;
586
- const client = self . configuration . newClient (
573
+ const client = this . configuration . newClient (
587
574
{ writeConcern : { w : 1 } } ,
588
575
{ maxPoolSize : 1 , monitorCommands : true }
589
576
) ;
@@ -592,7 +579,7 @@ describe('APM', function () {
592
579
client . on ( 'commandStarted' , filterForCommands ( desiredEvents , started ) ) ;
593
580
client . on ( 'commandSucceeded' , filterForCommands ( desiredEvents , succeeded ) ) ;
594
581
595
- const db = client . db ( self . configuration . db ) ;
582
+ const db = client . db ( this . configuration . db ) ;
596
583
597
584
const promises = [ ] ;
598
585
for ( let i = 0 ; i < 20 ; i ++ ) {
0 commit comments