@@ -8,12 +8,11 @@ import { createMongoDBConnection, sanitizeCollectionName, validatePipeline } fro
88const logger = createLogger ( 'MongoDBExecuteAPI' )
99
1010const ExecuteSchema = z . object ( {
11- connectionString : z . string ( ) . optional ( ) ,
12- host : z . string ( ) . default ( '' ) ,
13- port : z . coerce . number ( ) . int ( ) . nonnegative ( ) . default ( 27017 ) ,
11+ host : z . string ( ) . min ( 1 , 'Host is required' ) ,
12+ port : z . coerce . number ( ) . int ( ) . positive ( 'Port must be a positive integer' ) ,
1413 database : z . string ( ) . min ( 1 , 'Database name is required' ) ,
15- username : z . string ( ) . default ( ' ') ,
16- password : z . string ( ) . default ( ' ') ,
14+ username : z . string ( ) . min ( 1 , 'Username is required ') ,
15+ password : z . string ( ) . min ( 1 , 'Password is required ') ,
1716 authSource : z . string ( ) . optional ( ) ,
1817 ssl : z . enum ( [ 'disabled' , 'required' , 'preferred' ] ) . default ( 'preferred' ) ,
1918 collection : z . string ( ) . min ( 1 , 'Collection name is required' ) ,
@@ -62,7 +61,6 @@ export async function POST(request: NextRequest) {
6261 const pipelineDoc = JSON . parse ( params . pipeline )
6362
6463 client = await createMongoDBConnection ( {
65- connectionString : params . connectionString ,
6664 host : params . host ,
6765 port : params . port ,
6866 database : params . database ,
0 commit comments