我在meteor-angular app中使用此发布功能(在this tutorial之后创建):
Meteor.publish('organization', function (name) {
return Orgs.find({category: name});
}
我正在使用包含许多记录的生产数据库。因此,完成需要将近一分钟。 ATM足以让客户端检索前10个项目,这些项目可以随机选择。由于发送所有记录并在客户端过滤这些记录是不切实际的,我想限制Meteor.publish()
中提供的记录数。
根据the docs,可以使用limit
:
Meteor.publish('organization', function (name) {
return Orgs.find({category: name}, {limit: 10});
}
问题是,当此操作运行时,服务器会抛出异常:
I20160104-19:33:13.397(2)? organization publish b20884d3-90cb-49d7-9acd-3c4bd140e24b
I20160104-19:33:13.398(2)? Exception from sub organization id zaAjjJKg3pNnf7ZGP Error: Match error: Failed Match.OneOf or Match.Optional validation
I20160104-19:33:13.398(2)? at check (packages/check/packages/check.js:41:1)
I20160104-19:33:13.398(2)? at [object Object]._.extend._getFindOptions (packages/mongo/packages/mongo.js:3653:1)
I20160104-19:33:13.398(2)? at [object Object]._.extend.find (packages/mongo/packages/mongo.js:3689:1)
I20160104-19:33:13.398(2)? at [object Object]._handler (server/publications.js:11:1)
I20160104-19:33:13.398(2)? at maybeAuditArgumentChecks (livedata_server.js:1698:12)
I20160104-19:33:13.398(2)? at [object Object]._.extend._runHandler (livedata_server.js:1023:17)
I20160104-19:33:13.398(2)? at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
I20160104-19:33:13.398(2)? at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
I20160104-19:33:13.399(2)? at livedata_server.js:548:43
I20160104-19:33:13.399(2)? Sanitized and reported to the client as: Match failed [400]
I2
我是以正确的方式做到的吗?有什么建议或想法吗?
答案 0 :(得分:0)
是的,找到了解决办法:
meteor update pbastowski:angular-babel
然后看到:
pbastowski:angular-babel upgraded from 1.0.8 to 1.0.9
服务器异常消失了,就这么简单! 谢谢大家的评论,再次愉快的流星时间; - )
仅供参考我通过将pbastowski:angular-babel
降级回1.0.8并看到崩溃