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 createReadStream #140

Open
crossSulation opened this issue Dec 18, 2018 · 3 comments
Open

Gridfs-stream createReadStream #140

crossSulation opened this issue Dec 18, 2018 · 3 comments

Comments

@crossSulation
Copy link

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

@crossSulation
Copy link
Author

By the way, i am using mongoose

@crossSulation
Copy link
Author

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)

@crossSulation
Copy link
Author

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)

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