Похожие чаты

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 ответов

31 просмотр

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

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

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

а через ESC-код ?
Alexey Kulakov
29
30500 за редактор? )
Владимир
47
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
any reference of this implementation?
BitBuddha
29
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
13
Hi guys, any problem with Pulsebrige? Trying to transfer from wETH to ETH. First it tells me to connect my metamask "through mobile app" not desktop. Then I did and confirmed ...
Snowflakecrypto
11
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
11
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Карта сайта