Hello,
I have two questions:
First question:Is there a way to define a geospatial index (
https://docs.mongodb.com/manual/geospat ... al-indexes) as it is done with full text indices (
https://docs.jboss.org/hibernate/stable ... xt_indexes)?
Second questions:Geospatial queries need coordinates to be persisted in a defined order.
MongoDB Docs (
https://docs.mongodb.com/manual/geospat ... atial-data):
Quote:
Specify via an embedded document:
[...]
If specifying latitude and longitude coordinates, the first field, regardless of the field name, must contains the longitude value and the second field, the latitude value ; i.e.
<field>: { <field1>: <longitude>, <field2>: <latitude> }
I use the the following:
Code:
@Embeddable
public class LngLat implements Serializable {
private Double lng;
private Double lat;
public LngLat() {
}
public LngLat(Double lng, Double lat) {
this.lng = lng;
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
}
...but it gets persisted like this:
Code:
{ ..., "location" : { "lat" : 48.2088284029927, "lng" : 16.359914169215926 }, ...}
...the other way round.
Is there a way to define the order?
Thanks,
Paul