Facing issue on map

Hi Guys, I am trying to create a map based on events, lets's consider an event. It contains a lot of field along with longitude and latitude (both are separate fields) , now while plotting it on map I am getting whole document data by using the following query

collecton.find({}, {"longitude": 1, "latitude": 1, "_id": 0})

this above query return a lot of data ,like

{
field1 : string,
field2 : string,
field3 : array ,
field4 : boolean'
longitude : "20.310650"
latitude: "20.310650"
createAt : etc
}
{
field1 : string,
field2 : string,
field3 : array ,
field4 : boolean'
longitude : "20.310650"
latitude: "20.310650"
createAt : etc
}
{
field1 : string,
field2 : string,
field3 : array ,
field4 : boolean'
longitude : "20.310650"
latitude: "20.310650"
createAt : etc
}

mapping over it isn't working as longitude field is expecting a string and if I map that return an array of objects same for latitude

Is there any way to fix this issue , I hope you understand the problem , if still need more clarification just ask ,

Hi @Abdullah_Moiz,

Thanks for reaching out! Can you share a description of what data output you need? Are you looking for 2 arrays of strings, one for a list of latitudes, and one for a list of longitudes?

i.e. for latitude, ["20.310650", "20.310650", "20.310650"]

Please share any relevant screenshots or links if you are able to :slightly_smiling_face: