Hello,
I have saved some data containing numbers as a Double in mongodb. After requesting my data in Realm with an aggregation, I get my data in a format like this:
{
"points": [
{
"geometry": {
"coordinates": [
{
"$numberDouble": "10.1"
},
{
"$numberDouble": "20.2"
}
]
}
},
{
"geometry": {
"coordinates": [
{
"$numberDouble": "10.1"
},
{
"$numberDouble": "20.2"
}
]
}
}
]
}
But I would like to get these in a JS-friedly format like this:
{
"points": [
{
"geometry": {
"coordinates": [10.1, 20.2]
}
},
{
"geometry": {
"coordinates": [10.1, 20.2]
}
}
]
}
How can I achieve this? I’m thinking of something like this:
{
"$set": {
"$points.geometry.coordinates": {
"$toDecimal": "$points.$.geometry.coordinates"
}
}
}
But maybe the solution is more complicated…
Thanks in advance,
Carsten