路由器中的流星订阅
Meteor subscription in 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"
我无法在客户端获取数据,那是我的发布无效!
query
未定义路由器中的以下行:
users: Meteor.users.find query, options
我的目标是在路由器路径/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"
我无法在客户端获取数据,那是我的发布无效!
query
未定义路由器中的以下行:
users: Meteor.users.find query, options