marcello3d/node-mongolian — Issue #82: Chunk not found error when piping gridfs file bigger than 256kb
Author: ualtinok
Created: 2012-01-25 18:35:23+00:00
State: open

Mongo version: 2.0.2
Node vers: 0.6.8
Mongolian: 0.1.16

Using the same mongodb connection after accessing a small file, if a file bigger than 256kb in size is accessed, it throws an error like this: [Error: Chunk not found: 1/2]

```javascript
var Db= require('mongodb').Db,
Server= require('mongodb').Server,
Mongolian = require('mongolian'),
fs = require('fs');
var server = new Mongolian(
"server1",
"server2",
"server3"
);
var db = server.db("fstore");

http.createServer(function(req, res) {
var filename = getfilenamereq(req);
gridfs.findOne(filename, function (err, file) {
if (!err && file) {
var stream = file.readStream();
stream.on("error", function(err){
console.log(err); //THROWS [Error: Chunk not found: 1/2]
}).pipe(res);
}
else
{
res.writeHead(404, {'Content-Type': 'text/plain'});
res.write('404 Not Found\n');
res.end();
}
});
}).listen(88);