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

Subscriptions with $contains and $search are not reactive #53

Closed
jpsear opened this issue Apr 15, 2017 · 7 comments
Closed

Subscriptions with $contains and $search are not reactive #53

jpsear opened this issue Apr 15, 2017 · 7 comments

Comments

@jpsear
Copy link

jpsear commented Apr 15, 2017

Steps to reproduce

Subscribe to a service, using a $search query:

app.service('/service').find({ query: { firstName: { $search: '^james' } } }).subscribe(callback)

Expected behavior

The client receives updates when a document is added/removed/changed that matches the query

Actual behavior

The client does not receive the update

Upon calling the initial registration of the subscription, all data is returned as expected. But, the subscription isn't reactive — so we don't receive any more data.

@daffl
Copy link
Member

daffl commented Apr 16, 2017

Only the official query syntax is supported. $contains and $search are currently still database specific extensions.

@daffl
Copy link
Member

daffl commented Apr 17, 2017

To get updates for queries with those parameters the always list strategy can be used for now.

@DominikTrenz
Copy link

DominikTrenz commented Jul 18, 2017

The official query syntax does not work for me. For example $gt and $gte

this.someService.find({ query: { $sort: { start: 1 }, start: { $gte: moment().startOf('day').toDate() } }, rx: { listStrategy: 'always' } });

This is not reactive - without the $gte it is reactive

@daffl
Copy link
Member

daffl commented Jul 18, 2017

@DominikTrenz This is unfortunately not enough information to reproduce and should also probably be a separate issue.

@DominikTrenz
Copy link

#62 I created a new issue. Please let me know if you need more information

@daffl
Copy link
Member

daffl commented Feb 14, 2018

#97 adds the ability to add custom sift expressions which allows to implement non-standard special keywords:

const feathersRx = require('feathers-reactive');

feathersRx.sift.use({
  $search(a, b) {
    return (a & b) ? 0 : -1; // 0 = exists, -1 = doesn't exist
  }
});

@daffl daffl closed this as completed in #97 Feb 14, 2018
@jskrzypek
Copy link

Awesome! An elegant solution! Thanks, @daffl

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

4 participants