@@ -4,7 +4,7 @@ import { MongoDBAtlasVectorSearch } from '@langchain/mongodb'
4
4
import { Embeddings } from '@langchain/core/embeddings'
5
5
import { Document } from '@langchain/core/documents'
6
6
import { ICommonObject , INode , INodeData , INodeOutputsValue , INodeParams , IndexingResult } from '../../../src/Interface'
7
- import { getBaseClasses , getCredentialData , getCredentialParam } from '../../../src/utils'
7
+ import { getBaseClasses , getCredentialData , getCredentialParam , getVersion } from '../../../src/utils'
8
8
import { addMMRInputParams , resolveVectorStoreOrRetriever } from '../VectorStoreUtils'
9
9
10
10
class MongoDBAtlas_VectorStores implements INode {
@@ -191,15 +191,17 @@ let mongoClientSingleton: MongoClient
191
191
let mongoUrl : string
192
192
193
193
const getMongoClient = async ( newMongoUrl : string ) => {
194
+ const driverInfo = { name : 'Flowise' , version : ( await getVersion ( ) ) . version }
195
+
194
196
if ( ! mongoClientSingleton ) {
195
197
// if client does not exist
196
- mongoClientSingleton = new MongoClient ( newMongoUrl )
198
+ mongoClientSingleton = new MongoClient ( newMongoUrl , { driverInfo } )
197
199
mongoUrl = newMongoUrl
198
200
return mongoClientSingleton
199
201
} else if ( mongoClientSingleton && newMongoUrl !== mongoUrl ) {
200
202
// if client exists but url changed
201
203
mongoClientSingleton . close ( )
202
- mongoClientSingleton = new MongoClient ( newMongoUrl )
204
+ mongoClientSingleton = new MongoClient ( newMongoUrl , { driverInfo } )
203
205
mongoUrl = newMongoUrl
204
206
return mongoClientSingleton
205
207
}
0 commit comments