feat: use getColleciton syntax for mongo

This commit is contained in:
Pavel
2025-07-29 16:33:39 +02:00
parent 461f1e39fa
commit 6e8cdc24a3
2 changed files with 13 additions and 10 deletions

View File

@@ -138,15 +138,18 @@ const driver = {
await this.script(dbhan, `db.createCollection('${operation.collection.name}')`);
break;
case 'dropCollection':
await this.script(dbhan, `db.dropCollection('${operation.collection}')`);
await this.script(dbhan, `db.getCollection('${operation.collection}').drop()`);
break;
case 'renameCollection':
await this.script(dbhan, `db.renameCollection('${operation.collection}', '${operation.newName}')`);
await this.script(
dbhan,
`db.getCollection('${operation.collection}').renameCollection('${operation.newName}')`
);
break;
case 'cloneCollection':
await this.script(
dbhan,
`db.collection('${operation.collection}').aggregate([{$out: '${operation.newName}'}]).toArray()`
`db.getCollection('${operation.collection}').aggregate([{$out: '${operation.newName}'}]).toArray()`
);
break;
default: