Open crossSulation opened 5 years ago
By the way, i am using mongoose
sorry, my fault, actually, when construct the GridFSStream, the second argument should the the instance of mongodb
this._gridfs = GridFSStream(this._conn.connection.db,conn.mongo)
Made a mistake, actually ,it works, when construct the GRIDFSStream, the second argument should be the instance of moogodb
this._gridfs = GridFSStream(this._conn.connection.db,conn.mongo)
const readStream =this._gridfs.createReadStream(file.filename); readStream.on('error',(error)=>{ resp.send('No Image from that title!'); resp.end(); }) readStream.pipe(resp);
code like these, when only set up the readStream with filename, it will throw error , this._store = new grid.mongo.GridStore(grid.db, this.id || new grid.mongo.ObjectID(), this.name, this.mode, options);
when I debug, I found grid.mongo.ObjectID is undefined