Advice on how how to query on my job booking project

Hi all,
I am a recently new developer currently working on a job booking project for security staff but I am currently stuck as I do not know how to implement a feature.

Project Description
Clients posts a job that is seen by all security staff

Security staff can query
-all available job postings
-self booked jobs

I have a job Posting collection for the client which includes the following:
-total number of security staff required,
-array holding objects of a shift start and end time, cause some jobs run for subsequent amount of days. Example is shifts: [{start: Date, end: Date}]

Also have a Shift collection for the security staff which includes the following:
-postingId for the job posting,
-staffId for the security staff,
-clockIn time of type Date,
-clockOut time of type Date

My issue:
When security users view all available jobs, I only want all open jobs whose start and end times do not coincide with any of the future jobs booked by self.
Thereby any jobs which coincides with the security staff booked hours would not be seen by the security staff. Also being able to limit that clash I can be able to display jobs with enforced break gaps in between shifts, one shouldn’t be able to view or apply for a job that is starting shortly after a previous 8+ hours shift.

A security staff has a booked job starting 12:00 and ending 20:00 today. When the staff queries all available job postings, the staff should not be able to view any job starting or finishing within 12:00 and 20:00 today.
Implementing that helps me in imposing breaks, if a security staff has a booked job same as above, the should not be able to view any open jobs starting less than 8hrs after the booked job

I have tried most of what looks reasonable to me for the past week from the aggregation pipeline documentation and online search but with no result.
I appreciate any help that could be given for this, thanks.