gridfs-stream icon indicating copy to clipboard operation
gridfs-stream copied to clipboard

Gridfs-stream using Mongoclient

Open sgokulnath opened this issue 6 years ago • 0 comments

I am trying to use gridfs-stream with mongoclient and read the list of files stored in mongodb

let gfs;
MongoClient.connect("mongodb://localhost:27017/file_upload", function   (err, db) {
    gfs = GridFsStream(db, mongo);
});

router.get('/', function(req, res){
   gfs.collection('uploads').find({}).toArray(function (err, files) {
           if(err) throw err;
           console.log("Function Called");
           console.log(files);
   });
});

When I call the '/' request, it does not show anything. Even the "Function Called" is not printed. Would be helpful if any possible solution is recommended.

Thanks in advance.

sgokulnath avatar Oct 14 '18 17:10 sgokulnath