I need some guidance on my implementation of publish and subscribe in Meteor JS. I am new to this and seeking help to ensure that I am doing it correctly. If you require more information about my code, I am happy to provide additional source code. Despite reading the documentation on publish and subscribe, I found it difficult to fully grasp the concept.
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
export const Notes = new Mongo.Collection('notes');
if(Meteor.isServer) {
Meteor.publish('secureData', function() {
return Notes.find({});
});
}
if(Meteor.isClient) {
Meteor.subscribe('secureData');
}