mirror of
https://github.com/umami-software/umami.git
synced 2026-02-21 04:55:36 +01:00
feat: support mongodb connection
This commit is contained in:
parent
586529a5ca
commit
bb30b43a8e
9 changed files with 370 additions and 30 deletions
|
|
@ -4,6 +4,7 @@ export const MYSQL = 'mysql';
|
|||
export const CLICKHOUSE = 'clickhouse';
|
||||
export const KAFKA = 'kafka';
|
||||
export const KAFKA_PRODUCER = 'kafka-producer';
|
||||
export const MONGODB = 'mongodb';
|
||||
|
||||
// Fixes issue with converting bigint values
|
||||
BigInt.prototype.toJSON = function () {
|
||||
|
|
@ -15,6 +16,8 @@ export function getDatabaseType(url = process.env.DATABASE_URL) {
|
|||
|
||||
if (type === 'postgres') {
|
||||
return POSTGRESQL;
|
||||
} else if (type === 'mongodb+srv') {
|
||||
return MONGODB;
|
||||
}
|
||||
|
||||
return type;
|
||||
|
|
@ -23,7 +26,7 @@ export function getDatabaseType(url = process.env.DATABASE_URL) {
|
|||
export async function runQuery(queries) {
|
||||
const db = getDatabaseType(process.env.CLICKHOUSE_URL || process.env.DATABASE_URL);
|
||||
|
||||
if (db === POSTGRESQL || db === MYSQL) {
|
||||
if (db === POSTGRESQL || db === MYSQL || db === MONGODB) {
|
||||
return queries[PRISMA]();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue