One of the challenges I'm facing involves a complex method function that pulls data from various collections. These collections are defined in optional packages within the project. My current task is to determine if a specific collection is defined, indicating whether the package has been added to the project.
I attempted to use an if
statement for this purpose, but encountered issues. Despite this effort, I continue to receive the error message Articles is not defined
, causing the script to terminate prematurely.
Meteor.methods({
data: function () {
if (Articles) {
Articles.find(
{ parent: null },
{ fields: { title: true } }
);
}
}
});