Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional update in publishing join queries #74

Open
nodexpertsdev opened this issue Sep 8, 2016 · 0 comments
Open

Conditional update in publishing join queries #74

nodexpertsdev opened this issue Sep 8, 2016 · 0 comments

Comments

@nodexpertsdev
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant