collections script templates

This commit is contained in:
SPRINX0\prochazka
2024-08-28 14:26:34 +02:00
parent e71d278b20
commit 73ec42a9c8
5 changed files with 70 additions and 27 deletions

View File

@@ -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;