【发布时间】:2015-09-25 00:58:55
【问题描述】:
我尝试在此查询中使用 Meteor.publish(服务器端):
return Meteor.users.find({_id:{$ne:this.userId}});
当我在客户端使用 Meteor.subscribe 进行查询时,它可以工作:
return Meteor.users.find({_id:{$ne:Meteor.userId()}});
那么为什么它不能在服务器端工作...看来我只能在客户端查询它一次...问题是,我不想下载整个集合,因为我会超过20,000 名用户。发布方法是否不允许“$”查询?
另外,我怎样才能将它附加到我的以下查询语句:
return Meteor.users.find({"profile.loc":{ $near: [ to[0].profile.loc.lat, to[0].profile.loc.lon ], $maxDistance: (1/111.2)*250}});
【问题讨论】:
-
一切都按预期工作。如果您不希望在客户端上发布所有 20000 个用户,则不要发布它。阅读有关发布/订阅的更多信息。
标签: javascript meteor meteor-blaze meteor-accounts