Düzgün her veritabanı giriş için ortak id atama

0 Cevap php

Ben veritabanından girdileri almak ve bunları işlemek paralel çalışan on cron işleri olduğunu varsayalım.

The first cron job gets all the entries from database which have 'commonId' field as 1, the second one gets all the entries from database which have 'commonId' field as 2 and so on till 10.

Solution - When I am adding entries to the database from front-end, I have a file that has the "last" common id saved in it. This id is incremented till 10 and is then again set to 1 for each entry in database.

Hurdle - There are lots of users on front end and when adding the entries, a same common id is used for two or three consecutive entries. This should not happen. Every entry in database should have serial common id from 1-10.

Bunun için herhangi bir çözüm var mı? latest of latest ortak kimliği almak için?

Ben MongoDB kullanıyorum.

Bu mümkün değilse. Ne yapılabilir?

0 Cevap