meteor-mysql icon indicating copy to clipboard operation
meteor-mysql copied to clipboard

.change() method does not get new rows added after started meteor

Open VCarrasco opened this issue 9 years ago • 2 comments

If a game(new row) has been added to a player after started Meteor and I use .change(player_id) to get the current games for this player then I'm not getting the last row(the newest one).

VCarrasco avatar Jun 25 '15 01:06 VCarrasco

Can you provide any example code?

numtel avatar Aug 19 '15 05:08 numtel

I'm able to reproduce this. Here's the function:

liveDB = new LiveMysql(
{
// removed code
});

Meteor.publish('mData', function(id, filter)
{
    if (this.userId == null) return;
    if (typeof id == "undefined") return;

    this.onStop(function() 
    {
        if (liveDB.db.threadId != null)
        {
            liveDB.end();
        }
    }); 

    var query;
    if (filter.timespan == undefined)
    {
        query = "" // query 1
    } else {
        query = "" // query 2
    }

    var cursor = liveDB.select(query, [ { table: table } ]);
    return cursor; 
});

If I call 'change' on the mysql subscription and query 2 is used instead of query 1, the mysql subscription stays empty.

sushitommy avatar Aug 26 '15 14:08 sushitommy