0
的問題一個集合的數據集是我需要一個MongoDB的集合使用兩個流星
//lib/col.js
Photos = new Meteor.Collection("photos");
lastPhotos = function() {
return Photos.find({},{sort:{created_time:-1},limit:4});
}
locationPhotos = function(location_id_var)
{
//**doesn't return data from server, goes to local cache**
return Photos.find({location_id: location_id_var});
}
//server
Meteor.publish("lastPhoto", function()
{
return lastPhoto();
});
Meteor.publish("locationPhoto", function (location_id)
{
return locationPhoto(location_id);
});
//client
Meteor.subscribe("lastPhoto");
Meteor.subscribe("locationPhoto",{location_id:Session.get("location_id")});
該流星合併一個集合的兩個數據集的主要問題的兩個不同的數據集。
在模板中,我有兩個不同的演示文稿的一個集合。收藏品很大(6000個文檔),我無法將其全部發送給客戶。
如何在不將所有文檔發送到客戶端的情況下獲得一個集合的兩組不同文檔?
非常感謝你! –