[SOLVED] Angular-Meteor Meteor.publishComposite


Hello, thanks for read

When running helper brings values are stored in the variable verCandidatos.postulados.

Once I get me the information I need to get a document that is linked (using the function ng-init="candidato = la postulado.candidato()) wich runs on the helper from file: collection.js.

Sometimes the html shows the properties: {{candidato.nombre}}, {{candidato.apellidos}} and {{candidato.sexo}} correctly, and sometimes appear empty, why?

Is very strange, like a bug or something. How is possible that behavior?

The information is being obtained, because the ng-repeat works and shows elements.

Below is the publishComposite(), collection.js, html and js client

html client

<div ng-repeat="postulado in verCandidatos.postulados">
    <div ng-init="candidato = postulado.candidato();">

js in client

imports ...

class VerCandidatos {
    constructor($scope, $reactive, $stateParams) {
        this.vacanteId = $stateParams.vacanteId;
        this.subscribe('vacantes.candidatosOseleccionados', ()=> [{vacanteId: this.vacanteId}, {estado: 1}]);
            postulados (){
                return Postulaciones.find();




export const Postulaciones = new Mongo.Collection('postulaciones');


        return Candidatos.findOne({_id: this.candidatoId});



if (Meteor.isServer) {
    Meteor.publishComposite('vacantes.candidatosOseleccionados', function (vacanteId, estado) {
        const selector = {$and: [estado, vacanteId]};
            return {
                find: function () {
                    return Postulaciones.find(selector);
                children: [
                        find: function (postulacion) {
                            return Candidatos.find({_id: postulacion.candidatoId}, {
                                fields: {
                                    nombre: 1,
                                    apellidos: 1,
                                    sexo: 1,

Any ideas?

  • Thanks,


The ISSUE was in html
The solution was deteted ng-init and call directly the helpers inside collection.js, the other files (js in client, collection.js, publish.js) aren’t modify.

The html file is as follows:

<div ng-repeat="postulado in verCandidatos.postulados">

Thanks for read.
And I hope you will be useful.