gfs.chunks giving undefined for mongodb in express

Viewed 10

I am trying to data from the .chunks from gridFS. But I am not able to do so. While doing

gfs.chunks.find() it is giving me error like cannot find for undefined, when I did console.log(gfs.chunks) it showed me undefined, where as console.log(gfs.files) was giving the output. Can someone tell me how could I fix this.

let gfs;

conn.once('open', () => {
  // Init stream
  gfs = Grid(conn.db, mongoose.mongo);  
  gfs.collection('users');
  
});
0 Answers
Related