Hi Velo Legends ,
I would like to clear/Delete my Database for Every Month First date.
I got Cron Expression for that is
“0 4 1 * *” => Is this correct ?
Before i try to test the Job Schedular that
Delete the same for Every minute
But am getting Error:
“jsonPayload”: {
“message”:“Failed to parse job configuration for site ‘winkle’: The interval is above 1 hours”
“jsonContent”: NULL
My Code
// /backend/jobs.config
{
“jobs” : [ // Define up to 20 different jobs
// Choose one of the options below to define the job execution interval:
{
// Option 1 - define execution interval using a cron expression
“functionLocation” : “/events.js” , // Relatively to Backend folder, started by slash
“functionName” : “deleteAll” ,
“description” : “Deleting All details In database” , // Optional
“executionConfig” : {
“cronExpression” : “* * * * *” // Interval for every minutes
// Read about Cron expressions: [https://en.wikipedia.org/wiki/Cron#CRON_expression]
}
}
]
}
And In Events.js is:
import wixData from 'wix-data
// …
export function deleteAll () {
wixData . truncate ( "cache" ) // Here your collection/Database name should Come
. then (() => {
console . log ( "All items removed" );
})
. catch (( err ) => {
let errorMsg = err ;
});
}
–
My Database/Collection Name is “Cache”
Anyone Help me out please ?
What am doing wrong ?