[solved] Autopublish removed: publish-subscribe with "import" structure

After removing autopublish deadlock condition:

// lib/collection/collections.js
Cart.Items = new Mongo.Collection('cart-items');
// imports/api/server/publications.js
Meteor.publish('cartItems', function(dataQuery) { 
    return Cart.Item.find(dataQuery);
});
// imports/startup/client/routes/cart.js
items:Meteor.subscribe('cartItems',dataQuery)

console.log(items);

Object: ready()
stop()
subscriptionId: "LGgNZKueYjczMhbsr"
__proto__:.......................................

question: how to get data from this sub?
what is wrong?

You are missing an “s” …

oops, boner :grinning:
fixed,
now

Exception from Tracker recompute function:
meteor.js?hash=ae8b8af…:930 Error: {{#each}} currently only accepts arrays, cursors or falsey values.

with autopublish was no problems, how to debug it?

@orloff seems you lack the fundamentals of subscriptions. Please give a read http://www.meteor-tuts.com do the walkthrough it will clear a lot.

For your case I asume in your helper you return a cursor:

return Collection.find()

Instead you should return

return Collection.find().fetch(); // which is an array

if in publication i change Collection.find(); to find().fetch(), then:

Exception from sub cartItems id uDGazJXw48toheM2E Error: Publish function returned an array of non-Cursors

Meteor.subscribe i using in ironrouter’s render with data:

this.render('CartItems', {
    data: renderData
  });

where

renderData= ()=> {
return {
          items:Meteor.subscribe('cartItems',dataQuery),
}
}

Man, you are mixing up concepts. Please read the tutorial I gave you.

thanks for meteor-tutor link)

Meteor.subscribe('donuts')
var donats = DonutsCollection.find().fetch()
console.log(donats);
// undefined

please explain, how to fetch data from local minimongo, just after subscribe is ready?
probably need some asynchronous callback function?
within which I will collection.find()?

after add
onReady: function() {
collection.find()
}
worked ok,
big thanx for help)