Can we set cursor as a session variable?

javascript, meteor

Solution

Cursors can actually be stored in `Session`... sometimes. open the leaderboard app and try this in the browser console:

> 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, Object, Object, Object, Object]

Now download the code of the leaderboard example app, use the latest Meteor, and do the same thing in the browser console. You might get:

The moral of the story seems to be, don't store cursors in session variables. Store the Minimongo selector and options (`sort`, `fields` etc.) instead as objects.

Problem

I tried to set a cursor as a session variable looks like it is not working. Anyone has idea about it ?? My Code: ``` Meteor.call('apiresult',function(e,result) { console.log(result); Session.set("object",result) }); //getting variable var abc=Session.get("object"); return abc.skimlinksProductAPI.numFound; ``` looks like it's not working

Original source