This is probably the issue affecting gridform that i posted here. Same symptoms and it looks like gridform uses gridfs-stream in the same manner.
// requires omitted
read_id = // id string for a file i'm able to access in the mongo shell
write_id = new ObjectID();
// Is there a way to do this with gridstream.createReadStream?
// I don't see a way to open a file by id.
readStore = new GridStore(db, read_id, 'r');
readStore.open(function(err, readFile) {
// make streams
var readStream = readFile.stream();
var writeStream = gridstream.createWriteStream(write_id);
// pipe
readStream.pipe(writeStream);
readStream.on('end', function() {
// version 1: this one works
setTimeout(function() {
db.collection('fs.files', function(err, coll) {
coll.findOne({
_id: write_id
}, function(err, doc) {
// doc exists
});
});
}, 30);
// version 2: this one doesn't work
db.collection('fs.files', function(err, coll) {
coll.findOne({
_id: write_id
}, function(err, doc) {
// doc is null
});
});
});
});
This is probably the issue affecting
gridform
that i posted here. Same symptoms and it looks likegridform
usesgridfs-stream
in the same manner.