我试图将游标设置为会话变量,看起来它不起作用.
有人有想法吗?
我的代码:
Meteor.call('apiresult',function(e,result)
{
console.log(result);
Session.set("object",result)
});
//getting variable
var abc=Session.get("object");
return abc.skimlinksProductAPI.numFound;
Run Code Online (Sandbox Code Playgroud)
看起来它不起作用
游标可实际上存储在Session......的时候.打开排行榜应用程序并在浏览器控制台中尝试:
> Session.set('mycursor',Players.find());
undefined
> Session.get('mycursor')
LocalCollection.Cursor {collection:LocalCollection,selector_f:function,sort_f:null,skip:undefined,limit:undefined ...}
> Session.get('mycursor').fetch()
[Object ,对象,对象,对象,对象]
现在下载排行榜示例应用程序的代码,使用最新的Meteor,并在浏览器控制台中执行相同的操作.你可能得到:

故事的寓意似乎是,不要将游标存储在会话变量中.存储的Minimongo选择和选项(sort,fields等等),而不是为对象.
| 归档时间: |
|
| 查看次数: |
465 次 |
| 最近记录: |