So, I have 2 queries and both of them are dependent on each other, let me explain:
When I send a campaign I want the campaign to be marked as send and get added to queue.
status : String,
campaignId : mongooseId,
audience : [String],
If I am saving the queue first and check for its successful execution then after that I updated the campaign status to “ongoing” to mark it as added to queue, if for some reason the campaign update query get failed I will be left with a document wasting memory.
If I go the other way I may end up marking the campaign as “ongoing” but without any queue.
I have encountered this problem so many times at so many different queries, please help me on how to overcome it.