Hi,
I would like to run a cron job in my meteor app that can search thru one of my collections and check for docs that have a field data that has expired. Each doc as set date and need to see if the current date has passed. I would like to do this one a month and for each doc that has an expired date send an notification.
Hello @almong ,
I believe your problem can be solved easily with the provided example given in the synced-cron readme documentation.
You need to write a following method in your Meteor.isServer. here’s the snippet given in the documentation.
as you said you’d require to run the program once in month , schedule should be changed accordingly. you should be able to find the appropriate for your need in here parser docs
Hi Faysal,
Yes I have that without any issues I run into problem if I want to access Meteor.user in the cron function but I just moved it to a meteor method and it solves that issue
i know this is an old topic, but if you store the userId of the user the cron is for in an object that you’re passing to the SyncedCron.add func, you can then query Meteor.users() to get that user’s information. No Meteor.method required.