generate script menu for collections

This commit is contained in:
Jan Prochazka 2021-04-10 17:03:00 +02:00
parent 90169a7624
commit cc2c55b20f
2 changed files with 17 additions and 0 deletions

View File

@ -206,6 +206,17 @@
label: 'Export',
isExport: true,
},
{
divider: true,
},
{
label: 'JS: dropCollection()',
scriptTemplate: 'dropCollection',
},
{
label: 'JS: find()',
scriptTemplate: 'findCollection',
},
],
};

View File

@ -45,6 +45,12 @@ export default async function applyScriptTemplate(scriptTemplate, extensions, pr
if (procedureInfo) dmp.put('^execute %f', procedureInfo);
return dmp.s;
}
if (scriptTemplate == 'dropCollection') {
return `db.collection('${props.pureName}').drop()`;
}
if (scriptTemplate == 'findCollection') {
return `db.collection('${props.pureName}').find()`;
}
return null;
}