@@ -295,6 +295,16 @@ operations.set('dropCollection', async ({ entities, operation }) => {
295
295
}
296
296
} ) ;
297
297
298
+ operations . set ( 'drop' , async ( { entities, operation } ) => {
299
+ const bucket = entities . getEntity ( 'bucket' , operation . object ) ;
300
+ return bucket . drop ( ) ;
301
+ } ) ;
302
+
303
+ operations . set ( 'dropIndexes' , async ( { entities, operation } ) => {
304
+ const collection = entities . getEntity ( 'collection' , operation . object ) ;
305
+ return collection . dropIndexes ( ) ;
306
+ } ) ;
307
+
298
308
operations . set ( 'endSession' , async ( { entities, operation } ) => {
299
309
const session = entities . getEntity ( 'session' , operation . object ) ;
300
310
return session . endSession ( ) ;
@@ -372,16 +382,35 @@ operations.set('listCollections', async ({ entities, operation }) => {
372
382
return db . listCollections ( filter , opts ) . toArray ( ) ;
373
383
} ) ;
374
384
385
+ operations . set ( 'listCollectionNames' , async ( { entities, operation } ) => {
386
+ const db = entities . getEntity ( 'db' , operation . object ) ;
387
+ const { filter, ...opts } = operation . arguments ! ;
388
+ const collections = await db . listCollections ( filter , opts ) . toArray ( ) ;
389
+ return collections . map ( collection => collection . name ) ;
390
+ } ) ;
391
+
375
392
operations . set ( 'listDatabases' , async ( { entities, operation } ) => {
376
393
const client = entities . getEntity ( 'client' , operation . object ) ;
377
394
return client . db ( ) . admin ( ) . listDatabases ( operation . arguments ! ) ;
378
395
} ) ;
379
396
397
+ operations . set ( 'listDatabaseNames' , async ( { entities, operation } ) => {
398
+ const client = entities . getEntity ( 'client' , operation . object ) ;
399
+ const result = await client . db ( ) . admin ( ) . listDatabases ( operation . arguments ! ) ;
400
+ return result . databases . map ( database => database . name ) ;
401
+ } ) ;
402
+
380
403
operations . set ( 'listIndexes' , async ( { entities, operation } ) => {
381
404
const collection = entities . getEntity ( 'collection' , operation . object ) ;
382
405
return collection . listIndexes ( operation . arguments ! ) . toArray ( ) ;
383
406
} ) ;
384
407
408
+ operations . set ( 'listIndexNames' , async ( { entities, operation } ) => {
409
+ const collection = entities . getEntity ( 'collection' , operation . object ) ;
410
+ const indexes = await collection . listIndexes ( operation . arguments ! ) . toArray ( ) ;
411
+ return indexes . map ( index => index . name ) ;
412
+ } ) ;
413
+
385
414
operations . set ( 'loop' , async ( { entities, operation, client, testConfig } ) => {
386
415
const controller = new AbortController ( ) ;
387
416
// We always want the process to exit on SIGINT last, so all other
@@ -680,6 +709,12 @@ operations.set('withTransaction', async ({ entities, operation, client, testConf
680
709
} , options ) ;
681
710
} ) ;
682
711
712
+ operations . set ( 'count' , async ( { entities, operation } ) => {
713
+ const collection = entities . getEntity ( 'collection' , operation . object ) ;
714
+ const { filter, ...opts } = operation . arguments ! ;
715
+ return collection . count ( filter , opts ) ;
716
+ } ) ;
717
+
683
718
operations . set ( 'countDocuments' , async ( { entities, operation } ) => {
684
719
const collection = entities . getEntity ( 'collection' , operation . object ) ;
685
720
const { filter, ...opts } = operation . arguments ! ;
0 commit comments