F
F
Flakelf2018-09-15 23:04:45
MongoDB
Flakelf, 2018-09-15 23:04:45

By what criterion to update the collection in the database?

Evening at the house.
The question seems to be banal, but due to my inexperience, the following point is not clear to me:
There is a simple request to the server in the form of some data (see picture), let it be the same page for editing a profile on Instagram or changing a password on VK - do not important. The data arrives at the server, is processed, writes / rewrites some value in the database and gives the answer back to the client.
The question is how to correctly find the user for whom you need to change something? By cookies? By some value? If by some value, then where to get it? Send along with the request? Then why doesn't Instagram send anything like that? If it's about cookies, then after all, cookies can be cleaned and they will be generated again? Or write to each user in the database some hash from the login + password and write it to the cookie every time you enter the site? I'm completely lost, please help.
5b9d64ef76cb3740484927.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2018-09-16
@dimonchik2013

username test - not enough for you?

L
lega, 2018-09-16
@lega

Update by id, look for id by cookie, cookies can be both in the user object and outside.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question