router.post('/orders/finish', function(req, res, next) {
var order_id = req.body.order_id;
var user_id  = req.body.user_id;
var table_id = '';
var result = [];
mongo.connect(url, function(err, db) {
    assert.equal(null, err);
    db.collection('tables').update({id: table_id, status: true}, {$set: {status: false}}, function(err, result) {
        assert.equal(null, err);
    });
    var cursorTables = db.collection('tables').find({status: false});
    cursorTables.forEach(function(doc, err) {
        assert.equal(null, err);
        result.push(doc);
    }, function() {
        db.close();
        res.send(JSON.stringify(result));
    });
});
I'm updating table collection and try to get them, but I get old collection without updating. However in the next request its changed.
 
     
     
    