Collections publishing/subscribing in Meteor v1.3


#1

Hi,
I have trouble with collections on client

My code is next:

imports/api/formatTemplates/formatTemplates.js

export const FormatTemplates = new Mongo.Collection('formatTemplates');

imports/startup/server/index.js

import { FormatTemplates } from "/imports/api/formatTemplates/formatTemplates.js";
...
Meteor.publish("formatTemplates", () => {
    console.log("Publishing on server", FormatTemplates.find().fetch());
    return FormatTemplates.find();
});

imports/ui/userTemplates.js

import { FormatTemplates } from "/imports/api/formatTemplates/formatTemplates.js"
import { Template } from "meteor/templating";
import "./userTemplates.css";
import "./userTemplates.html";

Template.userTemplates.helpers({
      userTemplates: () => {
          return FormatTemplates.find();
      }
});

Template.userTemplates.onCreated(function () {
    Meteor.subscribe("formatTemplates", function () {
          console.log("Subscribing on client", FormatTemplates.find().fetch());
    });
});

So, when a browser renders the template I see message in server console “Publishing on server” with a lot of objects, but in browser console I see Subscribing on client [].

What is going with my collections, where I wrong?


#2

Ok, I have found the issue:

Exception while parsing DDP Error: Custom EJSON type Format is not defined(…)

This error raises only on the client side. On the server side everything is fine.