numtel/meteor-mysql

Conditional update in publishing join queries

nodexpertsdev opened this issue · 0 comments

We are using numtel:mysql in my project. We have created a publication named searchResults. My issue is as follows:

The searchResults liveDb publication currently returns:

return liveDb.select(sqlQuery, [{table: 'pages_metrics'}, {table: 'pages'}, {table: 'domains'}] );
This means that the subscription is updated every time there is any change in any of those tables.
Instead, we only want it to update when a row in the pages_metrics table matching keywordId is updated or inserted. I didn't find anything regarding this. I have tried like this:

return liveDb.select(sqlQuery,
[
            {
                table: 'pages_metrics',
                condition: function (row, newRow) {
                    return row.keyword_id === keywordId
                }
            },
            {
                table: 'pages',
                condition: function (row, newRow) {
                    return false;
                }
            },
            {
                table: 'domains',
                condition: function (row, newRow) {
                    return false;
                }
            }
        ]
    );

But still the issue is same.

How we are going to achieve this?