openConnection(e.detail)} bind:modalOpen={addressBarModalOpen} /> {#if host && connection}
({ id: dbKey, collCount: Object.keys(connection.databases[dbKey].collections || {}).length || '', children: Object.keys(connection.databases[dbKey].collections).map(collKey => ({ id: collKey, menu: [ { label: `Drop ${collKey}`, fn: () => dropCollection(dbKey, collKey) } ], })).sort((a, b) => a.id.localeCompare(b)) || [], menu: [ { label: `Drop ${dbKey}`, fn: () => dropDatabase(dbKey) } ], }))} actions={[ { icon: 'reload', fn: reload }, { icon: '+', fn: evt => { if (activeDbKey) { contextMenu.show(evt, [ { label: 'New database', fn: () => newDb = {} }, { label: 'New collection', fn: () => newColl = {} }, ]); } else { newDb = {}; } } }, { icon: '-' }, ]} bind:activeKey={activeDbKey} bind:activeChildKey={activeCollKey} on:select={e => openDatabase(e.detail)} on:selectChild={e => openCollection(e.detail)} />
{/if}
{#if newDb}

Create a database

Note: databases in MongoDB do not exist until they have a collection and an item. Your new database will not persist on the server; fill it to have it created.

{/if} {#if newColl}

Create a collections

Note: collections in MongoDB do not exist until they have at least one item. Your new collection will not persist on the server; fill it to have it created.

{/if} {#key $contextMenu} {/key}