Saya akhirnya menggunakan melewati koleksi dan pemfilteran menggunakan angular:
Pengontrol
angular.module("sushisushi24").controller("SearchRestaurantsCtrl",
function($scope, $stateParams, $meteor){
$scope.branches = $meteor.collection(Branches).subscribe('branchesAndRestaurants');
$scope.restaurants = $meteor.collection(Restaurants);
}
);
Publikasi Meteor
Meteor.publish('branchesAndRestaurants', function(opts) {
branches = Branches.find();
restaurantIds = branches.map(function(branch) { return branch.restaurantId });
return [
branches,
Restaurants.find({_id: {$in: restaurantIds}})
];
});
Lihat
<div ng-repeat="branch in branches">
<div ng-repeat="restaurant in restaurants | filter: {_id:branch.restaurantId}">
<h3>{{restaurant.name}}</h3>
</div>
<address>{{branch.address}}</address>
</div>