I’m building a server using Nest.js & MongoDB and I’ve a user stored in MongoDB like this:
[
// ...
{
id: "1",
name: "Bob",
organizationID: "1",
role: "Admin",
// More stuffs
}
]
and on request I need to parse the token to performance some actions but the only relevant information for most all the request are:
{
id: "1",
organizationID: "1",
role: "Admin",
}
There’s a way on mongo to only read this data like Postgres does?
I’ve research the docs but I didn’t find anything like that, I could just load the whole object and pick the properties that I need but won’t it spent more bandwidth?
BTW this is probably not the only place I will need to do that so I’m in doubt if I should go back to postgres or keep on Mongo
What do you guys reccomend?