Emulating cursors with neo4jReactivitiy

So we are using meteor and neo4j using the neo4jReactivity package:

So we have some code that populates on web app:

Template.map.helpers({

  bits: function() {
    var myBits = Template.instance().bits.get();
    console.log(myBits);
    return myBits;
  }
});
Template.map.created = function(){
  var self = this;
  console.log('map rendered.');
  self.bits = new ReactiveVar("bits not yet processed.");
  Meteor.neo4j.call('allBits',{},function(error,data) {
    if (error)
      console.log(error);
    else 
      self.bits.set(data['a']);
  });
};

And then in our html page we have:

    {{ #each bits }}
      test<br/>
    {{/each }}

But we are getting the error:
Uncaught Error: {{#each}} currently only accepts arrays, cursors or falsey values.

Any thoughts on how to emulate the cursor structure? Thanks!

You don’t necessarily have to implement the cursor structure. It is sufficient to use an array - and I am assuming that data['a'] is not itself an array. Try self.bits.set(data)?

When I do console.log I am getting an array:

console.log(data['a']);
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]

Actually, I wonder if it’s the line:

self.bits = new ReactiveVar("bits not yet processed.");

That will cause the bits template helper to run, due to the reactiveVar being invalidated. When the helper runs at that point it returns "bits not yet processed." (a string, not an array). You could wrap it in [] to force it to a single entry array:

self.bits = new ReactiveVar(["bits not yet processed."]);