Retrieving Images stored in Mongodb with Nodejs
问题 I have small thumbnails stored in a MongoDB collection. While I can extract them with a .findOne() I can not serve them back over an ExpressJS route correctly. I am not storing thumbs on disk as the heroku environment does not guarantee persisted storage. I am not using GridFS as these are thumbs < 16MB. Inserting a a new document into the collection goes something like this: MongoClient.connect(url, function(err, db){ var newImg = fs.readFileSync(req.file.path); var encImg = newImg.toString(