2016-05-06 17 views
1

流星のアプリを書いていますが、検索ボックスにオートコンプリート機能を追加しようとしています。データは非常に大きく、サーバー上にあるため、クライアント上ではそれをすべて取得することはできません。これは基本的にユーザーのデータベースです。もし私が間違っていないなら、mizzao:autocompleteパッケージはそれを可能にするはずですが、動作させることができません。流星オートコンプリートサーバー側

Meteor.publish('autocompleteViewers', function(selector, options) { 
    Autocomplete.publishCursor(viewers.find(selector, options), this); 
    this.ready(); 
}); 

そして、ここでは、私は、クライアント上の検索ボックスに使用する設定は以下のとおりです:

getSettings: function() { 
    return { 
     position: 'bottom', 
     limit: 5, 
     rules: [{ 
     subscription: 'autocompleteViewers', 
     field: '_id', 
     matchAll: false, 
     options: '', 
     template: Template.vLegend 
     }], 
    }; 
    } 

しかし、私は、クライアント上で、このエラーを取得しておく

は、ここで私は、サーバー上で持っているものです:

Error: Collection name must be specified as string for server-side search at validateRule 

私は実際にこの問題を理解していません。パッケージコードを見ると、サブスクリプションフィールドが変数ではなく文字列であるかどうかがテストされているように見えます。どのような問題が起こる可能性がありますか?そうでなければどこかで行くことができる最小の実例がありますか?私はドキュメントで1つを見つけることができませんでした。

答えて

1
Error: Collection name must be specified as string for server-side search at validateRule 

あなたが引用符でCollection名を指定していないため、このエラーが発生します。詳細については

getSettings: function() { 
return { 
    position: 'bottom', 
    limit: 5, 
    rules: [{ 
    subscription: 'autocompleteViewers', 
    field: '_id', 
    matchAll: false, 
    collection: 'viewers', // <- specify your collection, in your case it is a "viewers" collection. 
    options: '', 
    template: Template.vLegend 
    }], 
}; 

}

hereをお読みください。

希望すると便利です。