1
私にはuserId
のアイテムを含むコレクションFiles
があります。コレクション内にすべてuserId
のユニークな配列が必要です。メテオコレクションからユニークなアイテムを取得
ここに私の最初のアプローチ(ここからコード:LINK)
サーバー方法
'uniqUser': function(){
const distinct = Meteor.wrapAsync(Files.rawCollection().distinct,Files.rawCollection());
const result = distinct('userId');
console.log(result)
return result
}
クライアント呼び出し
uniqUser(){
Meteor.call('uniqUser', function(err, data) {
console.log(data);
return data;
});
}
私の見解は何も表示されません!また、エラー...
uniqUser:
{{#each uniqUser}}
<p>{{this}}</p>
{{/each}}
あなたの 'uniqUser'は' {uniqUser:["fsdfd"、 "ooop"]} 'のようなオブジェクトのキーでなければなりません –