Похожие чаты

Can someone suggest me when to use db transactions? I

have social media pp in which I have account id and account type on frontend side. On server side when I receive these account details i.e array of object each having account info. So I store access_token corresponding to each account and this logic is handled on server side. So if I am looping on each account what if one fails to store access token in db and others don't. Should I use upsert in this case if failed then upsert otherwise insert or should I use db transactions i.e add access token for all accounts or none

5 ответов

50 просмотров

You need transactions when you have to do multiple sql operations that should be performed all, or in case of error none

Adi- Автор вопроса
Marco De Nittis
You need transactions when you have to do multiple...

In my case I am using mongodb to update multiple documents inside collection so for that should I use transactions or no? Because on each document I am making API request to third party service.

Transactions on mongo? 😀 wow Still not clear the implications of your use case: but in alternative to transaction you could use a multi step, idempotent strategy: for each document make an update marking that the “logical transaction” is in progress, so if it’s ok the 3rd party call update again closing the operation, otherwise you could manage the situation as well

Adi- Автор вопроса
Marco De Nittis
Transactions on mongo? 😀 wow Still not clear the ...

Let me explain once: My application I want to connect multiple social media accounts and I am sending array of object each object having account details required. Now once dataa is jnside server side route I am making a loop on this array and making API call to social media providers to get access token for making requests on behalf of users. Lets say I want to connect twitter FB and instagram account to my app. If I run loop on them it might happen fb and instagram account got connected but twitter did not get connected. So how should I do it.??? If no transactions then how to do error handling on frontend or backend side like if only fb and twitter got connected but instagram failed

Adi
Let me explain once: My application I want to conn...

It depends from what you need to do in this case, you could simple handle the “connection” error in the backend and perform a single update after all

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта