i struggling return publication specific author based on data field in first mongo query.
in below posts subscription works absolutely fine, authors subscription never returns anything. assuming has async code.
meteor.publish("postandauthor", function (postid) { check(postid, string) var post = posts.find({_id: postid}); var authorid = post.authorid; return [ book, authors.find({_id: authorid}) ]; });
found answer: comment brian stated, treating post variable object not cursor. publications require cursors returned though best way authorid using
var authorid = post.fetch()[0].authorid;
Comments
Post a Comment