Joint object in collection transformation is undefined

I have this publication with join transformation

export var Posts = new Mongo.Collection<Post>(‘posts', {
    transform: function(doc) {
        doc.user = Meteor.users.findOne(doc.userId);
        doc.category = Categories.findOne(doc.categoryId);
        return doc;

this works well with autopublish, but without it, category object is undefined, can someone help me understand why?
note: Yes I published and subscribed to posts and categories, and I am getting the joint user object, but not the category object.

Is it possible your categories subscription isn’t ready yet? transform functions aren’t called reactively.

I am not sure, any suggestions in mind?

Any one knows the answer?

I would suggest looking into using the reywood:publish-composite package to handle this, instead of handing it via a transform.

Thanks for the suggestion @hwillson, I tried it but it puts the children objects in a separate client pub which is a problem specially I am not using Blaze I am using Angular.

This issue (and solution) might help from the angular-meteor repo: