Problem replica cluster Atlas in read and writes

Hi Guys i have this problem My app book a side by user there is a problem when some person click exactly in same time becouse before i search if the side is booked and if is not found i write a record to book a side.

But if i have a replica and the click in in the same millisecond the IF can not found nothing and i have two book for some side.

momentarily i have insert an delay of random millisecond at start of my methods but there is a system to resolve this? For example can i force read and write from some primary server of a cluster inside my methods?

Thank you in advance for any reply


Check about mongodb transactions