gridfs-stream
gridfs-stream copied to clipboard
Gridfs-stream using Mongoclient
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.