I'm not talking about real money transactions
The project I'm working on is a game in which players trade with each other. This is basically a transaction process, player A gives player B 10 cereals in exchange for thirty cows, you get the idea.
But since it is interactive, and there are many players at the same time, in a chat-like environment, all the random trading operations I wondered if this thing could be done with node.js , but I see problems.
I come from a database of databases where transaction processing and the nature of rollback and commit necessary to maintain the state of the database. But if we say node.js plus mongoDB (or any other noSQL database), then this is definitely a completely different mentality, but I just donβt see how it can handle trade in the sense that only two parties should be involved. without resorting to any form of locking, but, of course, not about what node about.
I have not found anything yet, but it does not surprise me, because node.js is so new.
UPDATE . I know the mechanisms of a transaction - and in particular banking style transactions, but they are not the same thing. Perhaps I did not make it clear, but the problem is that player B is selling something to the community of buyers.
This means that although player A initiates the purchase instruction on the client side, it is also possible that around the same time, player CD or E also clicks to buy the same cow.
Now, in a normal transaction, it is expected that at least the first person who gets a lock on the record level table will at least block the other parties from what is happening at that point in time.
However, the nature of node use and, in particular, its speed, parallel processing and use to display the database of updates in real time means that I could easily imagine that the slowest person wins (we say milliseconds).
For example, player A initiates a purchase at the same time as player C. The player completes the transaction, and Grottoes are paid to player B, and a cow is assigned to player A in the database. After a millisecond, the cow is assigned to player C.
I hope this explains the problem better.