@@ -42,11 +42,12 @@ export async function ingestData(config, options) {
4242
4343 // Restructure the config to match expected format
4444 const ragConfig = {
45- mongodb : {
46- uri : config . mongoUrl ,
47- database : config . database ,
48- collection : config . collection
49- } ,
45+ // MongoDB connection details at top level
46+ connectionString : config . mongoUrl , // Try this instead of nested mongodb object
47+ databaseName : config . database , // Use full names at top level
48+ collectionName : config . collection ,
49+
50+ // Keep the rest of the config
5051 embedding : {
5152 provider : config . embedding ?. provider || config . provider ,
5253 apiKey : config . apiKey ,
@@ -59,18 +60,19 @@ export async function ingestData(config, options) {
5960 maxResults : config . search ?. maxResults || 5 ,
6061 minScore : config . search ?. minScore || 0.7
6162 } ,
62- indexName : config . indexName
63- } ;
64-
65- // Add MongoDB connection options
66- ragConfig . mongodb . options = {
67- useNewUrlParser : true ,
68- useUnifiedTopology : true
63+ indexName : config . indexName ,
64+
65+ // Add standard MongoDB options
66+ mongodbOptions : {
67+ useNewUrlParser : true ,
68+ useUnifiedTopology : true
69+ }
6970 } ;
7071
71- // Log the restructured config
72+ // Remove the mongodb nested object structure
7273 if ( isDevelopment ) {
73- console . log ( 'Restructured ragConfig:' , JSON . stringify ( ragConfig , null , 2 ) ) ;
74+ console . log ( 'Attempting to connect to MongoDB...' ) ;
75+ console . log ( 'MongoDB URI:' , ragConfig . connectionString ) ;
7476 }
7577
7678 // Set environment variables from config if they're not already set
@@ -93,7 +95,7 @@ export async function ingestData(config, options) {
9395
9496 if ( isDevelopment ) {
9597 console . log ( 'Attempting to connect to MongoDB...' ) ;
96- console . log ( 'MongoDB URI:' , ragConfig . mongodb . uri ) ;
98+ console . log ( 'MongoDB URI:' , ragConfig . connectionString ) ;
9799 }
98100
99101 await rag . connect ( ) ;
0 commit comments