Open huvber opened 9 years ago
Hi, I believe you may have the collection name and publish name reversed in your code... Also find()
needs some selector, right?
So something like:
Server:
var Coll = new Mongo.Collection('collName');
Meteor.publish('pubName', function () {
return Coll.find({}); // Note {} as selector!
});
node.js client:
// Omit DDP connection details
ddp.subscribe('pubName');
var obs = ddp.observe('collName');
obs.added = function (id) {
/// ...
};
I have the same problem too, but the following code is working:
var observer = ddpClient.collections.observe(()=>{
return ddpClient.collections.todos.find();
});
observer.subscribe(()=>{
console.log('sss');
});
could you please explain why?
Sorry, actually I was confused by the package "npm install ddp-client" there is no problem with this "npm install ddp" package
I'm trying to understand why the method
added
removed
andchanged
never trigger on my system. I create a little server in meteor that publish a collection like thisand in my nodejs software I write this code: