loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Why options.where of PersistedModel.createChangeStream is not implemented?

Open mackwan84 opened this issue 10 years ago • 12 comments

We are going to create a real time application with the help of angular-live-set and loopback. However, we would like to monitor changes under specific condition instead of all changes of a model. We found the options.where is described in the loopback document, unfortunately it is implemented.

mackwan84 avatar Feb 17 '16 04:02 mackwan84

Hi @mackwan84 I am not sure what do you mean. Could you explain further? Thanks. If you are having questions about options.where or PresistedModel, Please post questions at https://groups.google.com/forum/#!forum/loopbackjs. See https://github.com/strongloop/loopback/wiki/Questions for more details.

If you think this is a bug or requesting a feature, I will need more details. Thanks.

loay avatar Feb 25 '16 15:02 loay

Please refer to the official api document: http://apidocs.strongloop.com/loopback/#persistedmodel-createchangestream. For the createChangeStream method, a options.where argument can be used to include only changes of models matching this where filter in the ChangeStream. However, it doesn't work. Thanks.

mackwan84 avatar Feb 26 '16 02:02 mackwan84

Thanks for clarifying. Having a look.

loay avatar Feb 26 '16 06:02 loay

I am also experiencing this. The options.where does not seem to actually filter what gets streamed.

Example:

var es = require('event-stream');
module.exports = function(app) {
  var Example = app.models.Example;
  Example.createChangeStream({where: {id: 2}}, function(err, changes) {
    changes.pipe(es.stringify()).pipe(process.stdout);
  });
};

Publishes changes for everything changed on the Example model, not just for Example.id == 2

@FreakTheMighty

dancingshell avatar Mar 02 '16 01:03 dancingshell

There seem to be a few related tickets.

https://github.com/strongloop/angular-live-set/issues/11

#1454

FreakTheMighty avatar Mar 02 '16 07:03 FreakTheMighty

Any update on a fix?

gvillenave avatar Sep 19 '16 09:09 gvillenave

@gvillenave Please follow up with these issues: https://github.com/strongloop/angular-live-set/issues/11

#1454

A feature request is being made and it will be implemented according to priorities. Thanks

loay avatar Sep 21 '16 17:09 loay

Hi there, do you have any idea of when the options.where filter will be implemented? I have to choose for the right architecture form my prod solution and can't stand listening to thousands objects notifying their status changes instead of few needed events... thank you!

arakno76 avatar Nov 02 '16 13:11 arakno76

+1

matias-casal avatar Dec 06 '16 23:12 matias-casal

any update on this? I would also like to use this feature to avoid listening to thousands of objects.

jwebcat avatar Mar 20 '17 07:03 jwebcat

For any still looking for a solution to this see: https://github.com/strongloop/angular-live-set/issues/11 the solution posted there worked perfectly for me with a little massaging.

jwebcat avatar Mar 22 '17 07:03 jwebcat

Simply put, if this feature has not been implemented yet, please don't write it in the official documentation. As a common sense, official document = implemented + carefully tested

haotangio avatar Apr 11 '17 14:04 haotangio