mondora / asteroid

An alternative client for a Meteor backend
MIT License
734 stars 101 forks source link

change events not emitted when collection is changed on server #83

Open dcalacci opened 8 years ago

dcalacci commented 8 years ago

This is a great library, and I'd like to use it for a project I'm working on, but I've run into an issue that I'm not sure how to solve.

If I have a collection on a meteor server that the client is subscribed to:

server:

exampleCollection = new Mongo.Collection("example_collection");

Meteor.publish('example_collection', function() {
    return exampleCollection.find({
        limit: 100,
    });
});

and I subscribe on an asteroid client, and register a change event:

client

conn.subscribe('example_collection');
exampleCollection = conn.getCollection('example_collection');
exampleRQ = exampleCollection.reactiveQuery({});

exampleRQ.on('change', function() {
    console.log("example changed!");
});

and then do an insert on the server side: server

exampleCollection.insert({name: "I am an object"});

the change event is never fired. Is this a known issue?

alwc commented 8 years ago

I have the same problem as well

greenik commented 8 years ago

same here :-1:

dcalacci commented 8 years ago

Alternatively, if someone could give me some pointers on where to look, I can try fixing this myself?

aadamsx commented 7 years ago

Was this issue ever figured out?