路由器中的Meteor订阅

时间:2015-09-05 08:36:02

标签: mongodb meteor iron-router

我的目标是在路由器路径/ home2上发布客户端3个用户的用户数据。

代码如下:

Meteor.publish "featured_talent", ->
    console.log 'talent publishing:'
    query = 
        'profile.picture':
            $exists: true
            $ne: null
        'show_on_talent_view': true
        'profile.roles.talent': true

    options = 
        limit: 3
        fields:
            profile: 1
        sort:
            createdAt: -1
    usr = Meteor.users.find query, options
    return usr

订阅服务器上的路由器

Router.map ->
    @route "home2",
        path: "/home2"
        waitOn: ->
            Meteor.subscribe "featured_talent"

我无法在客户端获取数据,这是我的出版物无效!

1 个答案:

答案 0 :(得分:0)

路由器中以下行中的

query未定义:

users: Meteor.users.find query, options