I have a JSON file from randomuser.me like this. And I want to filter only few of the data, like name, login, email and remove others. but I don't know how to do this with mongoose and MongoDB.
"events": [
{
"_id": "622a2663658a760100143a4a",
"place": "Belfast",
"year": 2022,
"people": [
{
"name": {
"first": "Merita",
"last": "Giraud"
},
"picture": {
"large": "https://randomuser.me/api/portraits/women/31.jpg"
},
"gender": "female",
"email": "merita.giraud@example.com",
"age": 27,
"score": 9.174597203460992,
"_id": "622a2663658a760100143a4b"
},
{
"name": {
"first": "Nils",
"last": "Adam"
},
"picture": {
"large": "https://randomuser.me/api/portraits/men/9.jpg"
},
"gender": "male",
"email": "nils.adam@example.com",
"age": 53,
"score": 7.405307108969225,
"_id": "622a2663658a760100143a4e"
},
],
"__v": 0
}
]
I want to get these data and return theme as JSON data like this but I don't find the right query.
{
"name": {
"title": string,
"first": string,
"last": string
},
"email": string,
"login": {
"uuid": string,
"username": string
},
"registered": {
"date": datetime,
"age": int
},
"picture": {
"thumbnail": string
}
}