From 323782a90ad1b279315fb9b59f88795baa496422 Mon Sep 17 00:00:00 2001 From: Luiz de Oliveira Date: Fri, 1 Sep 2023 15:22:45 -0400 Subject: [PATCH] Set fields to delete explicitly to null instead of undefined --- src/JobDbRepository.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/JobDbRepository.ts b/src/JobDbRepository.ts index 3f216c7..44c9b8e 100644 --- a/src/JobDbRepository.ts +++ b/src/JobDbRepository.ts @@ -248,14 +248,14 @@ export class JobDbRepository { async saveJobState(job: Job): Promise { const id = job.attrs._id; const $set = { - lockedAt: (job.attrs.lockedAt && new Date(job.attrs.lockedAt)) || undefined, - nextRunAt: (job.attrs.nextRunAt && new Date(job.attrs.nextRunAt)) || undefined, - lastRunAt: (job.attrs.lastRunAt && new Date(job.attrs.lastRunAt)) || undefined, + lockedAt: (job.attrs.lockedAt && new Date(job.attrs.lockedAt)) || null, + nextRunAt: (job.attrs.nextRunAt && new Date(job.attrs.nextRunAt)) || null, + lastRunAt: (job.attrs.lastRunAt && new Date(job.attrs.lastRunAt)) || null, progress: job.attrs.progress, failReason: job.attrs.failReason, failCount: job.attrs.failCount, failedAt: job.attrs.failedAt && new Date(job.attrs.failedAt), - lastFinishedAt: (job.attrs.lastFinishedAt && new Date(job.attrs.lastFinishedAt)) || undefined + lastFinishedAt: (job.attrs.lastFinishedAt && new Date(job.attrs.lastFinishedAt)) || null }; log('[job %s] save job state: \n%O', id, $set);