Say we have an app that allows people to like or dislike pictures.
This looks like a data-intensive application, as you would expect a huge amount of (dis)like requests, so say we chose Node.js for it.
As we don't want people to vote more than once, we need a way of relating the picId and userId. This could be done:
- with a relational database, by using a table where picId and userId are keys,
- with NoSQL, by creating a 'file' for each user and storing there all the picIds she voted... or the other way around, creating a file for each picture and storing there all the userIds that have voted the pic.
This part of the DB will be intensively read and written, as for every vote you first need to check if the user has already voted and then write the new vote, plus updating the total vote count of the pic.
Which is the best option (based ONLY on technical reasons)?
UPSERToption.