Question

I have a mongoose schema like this:

l:{
    type: { type: String },
    coordinates: { type: Array }
}

and I'm looking for all Points and Polygons in the DB to get their coordinates but the problem comes with the Polygons, Example result:

_id: n26608798 -> Coordinates: [-4.4991265,36.6750467]
_id: n1753741872 -> Coordinates: [-4.498763,36.6717949]
_id: w93748323 -> Coordinates: [[null]]

The last result is a Polygon and [[null]]should be something like this:

[ [ [-4.4948252,36.6770003], [-4.4948708,36.6770321], [-4.4945418,36.6773356], [-4.4944965,36.6773035], [-4.4947042,36.6771119], [-4.4947491,36.6770705], [-4.4948252,36.6770003] ] ]

What I'm doing wrong?

Was it helpful?

Solution

Fixed. The problem was an eval() I was using above :/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top