You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ gfs }=require("../connnection/mongo.connection");exports.postRetriveAll=async(res,req)=>{try{// await establishConnection();console.log("Retrieved gfs:",gfs);// Retrieve all file details from the "uploads" bucketgfs.find({}).toArray((err,files)=>{if(err){console.error("Error:",err);}else{console.log("Files:",files);}});}catch(err){console.log(err);returnerr;}};
i have called establishConnection() function in app.js file initially and also called it once again in user.controller.js but it didn't worked i also used the promise method but it didn't work
The text was updated successfully, but these errors were encountered:
I'm trying to connect to the database and declare the gfs variable in one file and share it to another file where I want to fetch the file details
mongo.connection.js
user.controller.js
Output
i have called establishConnection() function in app.js file initially and also called it once again in user.controller.js but it didn't worked i also used the promise method but it didn't work
The text was updated successfully, but these errors were encountered: