diff --git a/frontend/src/organisms/connection/collection/update.svelte b/frontend/src/organisms/connection/collection/update.svelte index 85afc5d..cbffeda 100644 --- a/frontend/src/organisms/connection/collection/update.svelte +++ b/frontend/src/organisms/connection/collection/update.svelte @@ -46,10 +46,11 @@ let operation = '{ ' + form.parameters.filter(p => p.type).map(p => `${p.type}: ${p.value || '{}'}`).join(', ') + ' }'; if (operation === '{ }') { - operation = ''; + operation = '{}'; } - const code = `db.${collection.key}.${method}(${form.query || '{}'}${operation ? ', ' + operation : ''});`; + const options = form.upsert ? ', { upsert: true }' : ''; + const code = `db.${collection.key}.${method}(${form.query || '{}'}, ${operation}${options});`; return code; }