mongoku
Version:
[](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml)
69 lines (64 loc) • 2.69 kB
JavaScript
import { l as logger } from './logger-PfH_grbh.js';
import { g as getMongo } from './mongo-B92d7zNj.js';
import './shared-server-BmU87nph.js';
import 'async_hooks';
import 'node:util';
import 'dns/promises';
import 'mongodb';
import 'url';
import 'node:fs';
import 'node:os';
import 'node:path';
const load = async ({ params }) => {
const mongo = await getMongo();
const client = mongo.getClient(params.server);
const adminDb = client.db("test").admin();
const results = await adminDb.listDatabases();
if (!Array.isArray(results.databases)) {
return {
databases: []
};
}
const filteredDatabases = mongo.filterDatabases(results.databases);
const databases = await Promise.all(
filteredDatabases.map(async (d) => {
const db = client.db(d.name);
const dbStats = await db.stats().catch(() => {
logger.error(`Error getting stats for database ${d.name} on server ${params.server}`);
return {
dataSize: 0,
avgObjSize: 0,
storageSize: 0,
indexSize: 0,
collections: 0
};
});
return {
name: db.databaseName,
size: d.sizeOnDisk ?? 0,
dataSize: dbStats.dataSize,
avgObjSize: dbStats.avgObjSize,
storageSize: dbStats.storageSize,
totalIndexSize: dbStats.indexSize,
empty: d.empty ?? true,
nCollections: dbStats.collections
};
})
);
return {
databases
};
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
load: load
});
const index = 9;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-CAAPpbun.js')).default;
const server_id = "src/routes/servers/[server]/databases/+page.server.ts";
const imports = ["_app/immutable/nodes/9.CQcxG5IS.js","_app/immutable/chunks/DaMh_eeB.js","_app/immutable/chunks/IwGwbOe7.js","_app/immutable/chunks/BDGd1aqF.js","_app/immutable/chunks/CCOVnadf.js","_app/immutable/chunks/951V-MIZ.js","_app/immutable/chunks/DqxUmOYD.js","_app/immutable/chunks/CmI1igJD.js","_app/immutable/chunks/Dzt_TFtX.js","_app/immutable/chunks/C6P2UOyZ.js","_app/immutable/chunks/YMZQSnF3.js","_app/immutable/chunks/v8XDA7ui.js","_app/immutable/chunks/BUO1EOQu.js","_app/immutable/chunks/CkMoyTwc.js","_app/immutable/chunks/Z7BFksgg.js","_app/immutable/chunks/9xpgPu5N.js","_app/immutable/chunks/8tf5Lvl3.js","_app/immutable/chunks/CKvueigk.js","_app/immutable/chunks/BN_N9-2s.js"];
const stylesheets = ["_app/immutable/assets/Modal.CZgFKXkP.css"];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=9-DSgRe_DY.js.map