Urigo / meteor-rxjs

Exposing Mongo Cursor as RxJS Observable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

client find, server added->ready->changed does not trigger query update

jerradpatch opened this issue · comments

maybe I am misunderstanding how find should with with RXJS in Meteor.

if I have this on the client

Models

find(type): Observable<any[]> {
    return this.Models.find({});
}
constructor(){
MeteorObservable.subscribe('testCollection').subscribe();
this.Models = new MongoObservable.Collection<any>('testPublisher', {idGeneration: 'MONGO'});
}

and this on the server

Meteor.publish('testPublisher', function () {
    this.added('testCollection', 'testId', {doc: []});
    this.ready();
    this.changed('testCollection', 'testId', {doc: [{test:'test'}]});
})

shouldn't the 'this.changed' trigger the find results to return the updated model in the find query? However, I am only ever receiving the initial model from 'this.added'.

Thanks

cant even seem to get the changed doc even if I call,

let docs = new Subject();
        let sub = this.Models.find({})
            .observe({
                added(document, atIndex, before){
                    docs.next(document);
                },
                changed(newDocument, oldDocument)  {
                    docs.next(newDocument);
                }
            });