mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 16:13:58 +00:00
fixed mongoDB rename collection #1198
This commit is contained in:
@@ -167,21 +167,35 @@ const driver = {
|
|||||||
case 'createCollection':
|
case 'createCollection':
|
||||||
await this.script(dbhan, `db.createCollection('${operation.collection.name}')`);
|
await this.script(dbhan, `db.createCollection('${operation.collection.name}')`);
|
||||||
break;
|
break;
|
||||||
|
// case 'dropCollection':
|
||||||
|
// await this.script(dbhan, `db.getCollection('${operation.collection}').drop()`);
|
||||||
|
// break;
|
||||||
|
// case 'renameCollection':
|
||||||
|
// await this.script(
|
||||||
|
// dbhan,
|
||||||
|
// `db.getCollection('${operation.collection}').renameCollection('${operation.newName}')`
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// case 'cloneCollection':
|
||||||
|
// await this.script(
|
||||||
|
// dbhan,
|
||||||
|
// `db.getCollection('${operation.collection}').aggregate([{$out: '${operation.newName}'}]).toArray()`
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
|
||||||
case 'dropCollection':
|
case 'dropCollection':
|
||||||
await this.script(dbhan, `db.getCollection('${operation.collection}').drop()`);
|
await this.script(dbhan, `db.dropCollection('${operation.collection}')`);
|
||||||
break;
|
break;
|
||||||
case 'renameCollection':
|
case 'renameCollection':
|
||||||
await this.script(
|
await this.script(dbhan, `db.renameCollection('${operation.collection}', '${operation.newName}')`);
|
||||||
dbhan,
|
|
||||||
`db.getCollection('${operation.collection}').renameCollection('${operation.newName}')`
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 'cloneCollection':
|
case 'cloneCollection':
|
||||||
await this.script(
|
await this.script(
|
||||||
dbhan,
|
dbhan,
|
||||||
`db.getCollection('${operation.collection}').aggregate([{$out: '${operation.newName}'}]).toArray()`
|
`db.collection('${operation.collection}').aggregate([{$out: '${operation.newName}'}]).toArray()`
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Error(`Operation type ${type} not supported`);
|
throw new Error(`Operation type ${type} not supported`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user