I am new to MongoDB, my native language is Spanish. So I'm not sure how to find what I need.
I will try to make myself understandable.
I do this query and the result is an array.
For example :
Users.find({passport:123, (err, result) => {
//output of result
[
{"nombre":"pedro","apellido":"jose"},
{"nombre":"pablo","apellido":"jacinto"},
{"nombre":"jose","apellido":"berta"},
]
I want to know if there is a more effective way to do something so that using some function from mongodb I can customize the output to avoid doing something like this:
Required Output :
[
{"name":"pedro","lastname":"jose"},
{"name":"pablo","lastname":"jacinto"},
{"name":"jose","lastname":"berta"},
]
is there any way to process the output information directly from mongoDB?
nombreconvert toname&apellidotolastname? If yes there is no such thing that does directly, but you can write query to mapnombretoname..