isPersistedJob
Defined in: packages/core/src/jobs/guards.ts:37
Type guard to check if a job has been persisted to MongoDB.
A persisted job is guaranteed to have an _id field, which means it has been
successfully inserted into the database. This is useful when you need to ensure
a job can be updated or referenced by its ID.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
T | The type of the job’s data payload |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
job | Job<T> | The job to check |
Returns
Section titled “Returns”job is PersistedJob<T>
true if the job has a valid _id, narrowing the type to PersistedJob<T>