Closed nrw closed 11 years ago
not misusing. we'll need to review if we're listening to the proper event to trigger completion.
On Jul 7, 2012, at 2:59 AM, Nicholas Westlakereply@reply.github.com wrote:
In the
form.parse
callback, the new file's document is only available after a delay. I don't think this the intended behavior. Am I misusinggridform
?// Requires omitted. I don't think they're the // problem as every other operation using // node-mongo-native behaves as expected app.post('/', function(req, res) { var form = gridform({ db: db, mongo: mongo }); form.parse(req, function(err, fields, files) { var file = files.upload; // version 1: this works setTimeout(function() { db.collection('fs.files', function(err, coll) { coll.findOne({_id: file.id}, function(err, doc) { // doc exists }); }); }, 30); // version 2: this doesn't work db.collection('fs.files', function(err, coll) { coll.findOne({_id: file.id}, function(err, doc) { // doc is null }); }); }); });
Reply to this email directly or view it on GitHub: https://github.com/aheckmann/gridform/issues/1
it looks like the write stream end
event is the trigger. is there a close
event we can wait for?
fixed in 0.1.2
In the
form.parse
callback, the new file's document is only available after a delay. I don't think this the intended behavior. Am I misusinggridform
?