mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
update
This commit is contained in:
@@ -9,15 +9,20 @@ let mongoClientSingleton: MongoClient
|
|||||||
let mongoUrl: string
|
let mongoUrl: string
|
||||||
|
|
||||||
const getMongoClient = async (newMongoUrl: string) => {
|
const getMongoClient = async (newMongoUrl: string) => {
|
||||||
if (!mongoClientSingleton || newMongoUrl !== mongoUrl) {
|
if (!mongoClientSingleton) {
|
||||||
|
// if client doesn't exists
|
||||||
|
mongoClientSingleton = new MongoClient(newMongoUrl)
|
||||||
|
mongoUrl = newMongoUrl
|
||||||
|
return mongoClientSingleton
|
||||||
|
} else if (mongoClientSingleton && newMongoUrl !== mongoUrl) {
|
||||||
|
// if client exists but url changed
|
||||||
|
mongoClientSingleton.close()
|
||||||
mongoClientSingleton = new MongoClient(newMongoUrl)
|
mongoClientSingleton = new MongoClient(newMongoUrl)
|
||||||
mongoUrl = newMongoUrl
|
mongoUrl = newMongoUrl
|
||||||
await mongoClientSingleton.connect()
|
|
||||||
return mongoClientSingleton
|
return mongoClientSingleton
|
||||||
}
|
}
|
||||||
return mongoClientSingleton
|
return mongoClientSingleton
|
||||||
}
|
}
|
||||||
|
|
||||||
class MongoDB_Memory implements INode {
|
class MongoDB_Memory implements INode {
|
||||||
label: string
|
label: string
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
Reference in New Issue
Block a user