Unique
job.unique(filter, options?)
job.unique(filter, options?)
Example Usage
const job = pulse.create('test', {});
job.unique({ 'data.type': 'email', 'data.userId': '12345' });
await job.save(); // If you want to save it
Parameters
filter
(Filter<TSchema>
): A MongoDB filter object that defines the criteria for job uniqueness. This filter is used to check existing jobs in the database to ensure that no other job with the same attributes exists.options
({ insertOnly: boolean }
- optional): Additional options to control the uniqueness check. TheinsertOnly
option, if set totrue
, ensures that the uniqueness check is only applied when the job is first created, not on subsequent updates.
Returns
Job
: Returns the job instance with the uniqueness criteria applied. This allows for method chaining.
Last updated
Was this helpful?