我嘗試使用Meteor.publish(服務器端)與此查詢:當我做與Meteor.subscribe客戶端的查詢MeteorJS發佈查詢不能
return Meteor.users.find({_id:{$ne:this.userId}});
,它的工作原理:
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個用戶,則不會發布它。閱讀更多關於發佈/訂閱的信息。 – ZuzEL