I would like to know how can I do a model that is persisted with mongoose, that can allow something like this:
var coordsInfo = Map.coordinates[x,y].someInfo;
So Map would be something as this:
Map:
name
coordinates:
someInfo
anotherInfo
I'm noob in JS and don't know how to do this, and I'm not familiar with mongoose modeling to do it too.
Thanks.
Ok, so I'm thought of this solution:
Coordinate
x,
y,
someInfo,
anotherInfo,
Map
name ,
coords : [Coordinate]
And then add a virtual method in map to return:
coordinates(x,y)
this.coords.filter(x:x,y:y)
something like that. But still not sure of it =/