Bugfix/closing mongodb connections (#2085)

* mongodb connection issue

* updating and pinning mongodb version

* removing pnpm-lock.yaml

* converting to a singleton

* Update pnpm lock file

* Downgrade mongodb

---------

Co-authored-by: vinodkiran <vinodkiran@usa.net>
Co-authored-by: Vinod Paidimarry <vinodkiran@outlook.in>
This commit is contained in:
Octavian FlowiseAI
2024-04-02 14:57:20 +02:00
committed by GitHub
parent b9b0c9d227
commit ea255db15d
4 changed files with 191 additions and 334 deletions
@@ -1,5 +1,5 @@
import { MongoClient, Collection, Document } from 'mongodb'
import { MongoDBChatMessageHistory } from '@langchain/community/stores/message/mongodb'
import { MongoDBChatMessageHistory } from '@langchain/mongodb'
import { BufferMemory, BufferMemoryInput } from 'langchain/memory'
import { mapStoredMessageToChatMessage, AIMessage, HumanMessage, BaseMessage } from '@langchain/core/messages'
import { convertBaseMessagetoIMessage, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
@@ -10,7 +10,7 @@ let mongoUrl: string
const getMongoClient = async (newMongoUrl: string) => {
if (!mongoClientSingleton) {
// if client doesn't exists
// if client does not exist
mongoClientSingleton = new MongoClient(newMongoUrl)
mongoUrl = newMongoUrl
return mongoClientSingleton