如何在具有 mizzao:user-status 的客户端上获取 status.online 标志

How to get the status.online flag on the client with mizzao:user-status

我有这个出版物:

  Meteor.publish 'online_users', ->
    Meteor.users.find({
      status:
        online: true
    }, {
      fields: {
        'status.online': 1
        _id: 1
        profile : 1
      }
    })

和订阅:

Meteor.subscribe "online_users"

在服务器meteor shell中,我可以这样做:

Meteor.users.find({}, {fields: {status: 1}}).fetch()
// [ { _id: '3afnN78MCkSs8w8W6',
//  status: { online: true, lastLogin: [Object], idle: false } } ]

但是在客户端上我没有得到 status.online 数据:

Meteor.users.find({}, {fields: {status: 1}}).fetch()[0]
// Object {_id: "3afnN78MCkSs8w8W6"}

我正在尝试制作一个显示在客户端上的用户列表,并区分在线用户和不在线用户。如果无法在客户端上看到 status.online 列,我不确定如何执行此操作。

正如 MasterAM 在评论中指出的那样,问题出在我的出版物上。

find( { status: { online: true } } ) 不行;必须是 find( { "status.online": true } )