何らかの理由で 0.5.9 にアップグレードした後、サーバー側ではすべてが正しく送信されているように見える問題が発生していますが、クライアント側では何も受信していないと表示されます。
//サーバ:
Meteor.publish("orders", function (ordersQueryParams) {
console.log("orders publish: " + JSON.stringify(ordersQueryParams));
if (this.userId && ordersQueryParams){
console.log("orders collection: " + Orders.find({"customer._id": this.userId}, ordersQueryParams).count());
return Orders.find({"customer._id": this.userId}, ordersQueryParams);
}
});
//クライアント:
var ordersPreferences = {
table: {
size: 10
},
query: {
sort: {createdDate:-1},
skip : 0,
limit : 10
}
};
Session.set("ordersPreferences", ordersPreferences);
Meteor.autorun(function(){
var ordersPreferences = Session.get("ordersPreferences");
console.log('subscribing to orders');
Meteor.subscribe("orders", ordersPreferences.query);
}
//両方:
Orders = new Meteor.Collection("orders");
Deps.autorun(function(){
if (Meteor.isServer)
console.log("on server orders count is " + Orders.find().count());
if (Meteor.isClient)
console.log("on client orders count is " + Orders.find().count());
});
サーバーログ:
on server orders count is 26
orders publish: {"sort":{"createdDate":-1},"skip":0,"limit":10}
orders collection: 26
クライアントログ:
subscribing to orders
on client orders count is 0
なぜサーバーは26個のドキュメントがあると言いますが、クライアントは0を主張しますか?
それは私を夢中にさせています:(