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?