【发布时间】:2014-12-17 07:18:03
【问题描述】:
当我使用 findOne 时,我的 Meteor 发布存在一些连线问题,但使用 find 时它不起作用,使用 findOne 时出现光标错误。
这是我的代码
Meteor.publish('organizations', function() {
var user = Meteor.users.findOne(this.userId);
if(!user) return '';
var debugTest = Organizations.findOne(user.organizationId);
console.log(debugTest._id);
//return Organizations.findOne({_id: user.organizationId});
});
为此我不确定
如果我执行以下操作
Meteor.publish('organizations', function() {
var user = Meteor.users.findOne(this.userId);
if(!user) return '';
console.log(user.organizationId);
var debugTest = Organizations.findOne(user.organizationId);
console.log(debugTest._id);
//return Organizations.findOne({_id: user.organizationId});
});
我取回了两个 ID,但返回时出现以下错误
我 NvoF9MimZ6tJ95c3m NvoF9MimZ6tJ95c3m
错误 来自 sub KLnQphHTXmQcjEi2D 错误的异常:发布函数只能返回一个游标或游标数组
【问题讨论】:
标签: javascript meteor