【发布时间】:2026-01-12 02:20:07
【问题描述】:
您好有以下实现:
public class Store {
private double[] position;
private String category;
}
而且这种搜索商店的方法就在附近
public List<Store> fundByLatLong(double latitude, double longitude, Double km) {
mongoTemplate.indexOps(Store.class).ensureIndex(new GeospatialIndex("position"));
Point point= new Point(latitude, longitude);
List<Store> stores= this.storeRepository.findByPositionNear(ponto , new Distance(km, Metrics.KILOMETERS));
return stores;
}
但我需要按职位和类别搜索。如何为查找添加参数类别?
【问题讨论】:
标签: mongodb spring-data