O
O
olezhenka2018-05-16 20:59:50
MongoDB
olezhenka, 2018-05-16 20:59:50

Why is _id needed?

I know that this is the unique id of any document from any collection. I see the point in using it in the document of the logged in user to store it in the session and identify it. There is a sense to yuzat it for simplification of search in a DB.
But, let's say I have a collection of VK users, I can identify a user by id in VK. Does it make sense to use objectId here? With the condition that I will not have the "/vk/get?id=..." route, where I simply give the user id and get the user I need from my database, I will receive data about the user from VK only using the session .
And still about simplification of search on a DB. Is it safe to give the objectId to the frontend? For me, this immediately begins to be associated with a vulnerability :( Here, too, with the condition that using the session and checking that the document being searched belongs to the user from the session.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question