mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 13:46:00 +00:00
collections script templates
This commit is contained in:
@@ -150,6 +150,33 @@ const driver = {
|
||||
|
||||
supportFieldRemoval: true,
|
||||
},
|
||||
|
||||
getScriptTemplates(objectTypeField) {
|
||||
switch (objectTypeField) {
|
||||
case 'collections':
|
||||
return [
|
||||
{
|
||||
label: 'JS: dropCollection()',
|
||||
scriptTemplate: 'dropCollection',
|
||||
},
|
||||
{
|
||||
label: 'JS: find()',
|
||||
scriptTemplate: 'findCollection',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
|
||||
async getScriptTemplateContent(scriptTemplate, props) {
|
||||
switch (scriptTemplate) {
|
||||
case 'dropCollection':
|
||||
return `db.${props.pureName}.drop();`;
|
||||
case 'findCollection':
|
||||
return `db.${props.pureName}.find();`;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = driver;
|
||||
|
||||
Reference in New Issue
Block a user