Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gridfs-stream using Mongoclient #138

Open
sgokulnath opened this issue Oct 14, 2018 · 0 comments
Open

Gridfs-stream using Mongoclient #138

sgokulnath opened this issue Oct 14, 2018 · 0 comments

Comments

@sgokulnath
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant