小编Sab*_*chi的帖子

java中地理空间字段的2dsphere索引的Spring mongodb注释......?

@JsonSerialize
@Document(collection = "fence")
@CompoundIndexes({
        @CompoundIndex(name = "loc_groupId_idx", 
                       def = "{ 'loc': 2dsphere, 'groups.groupId': 1 }",      
                       unique = false) })
public class GeofenceMongoVO {

  public GeofenceMongoVO() {}

  @Id
  private String fenceId;

  @Field
  private Long customerId;

  @Field
  private String fenceName;

  @Field
  private Byte type;
Run Code Online (Sandbox Code Playgroud)

这就是我试图确保地理空间字段和子文档(groupId)字段上的复合索引的方式。但不幸的是,这不起作用。有没有一种方法可以通过注释从java代码中确保2dsphere索引?

spring mongodb spring-mongo spring-mongodb

2
推荐指数
1
解决办法
1949
查看次数

标签 统计

mongodb ×1

spring ×1

spring-mongo ×1

spring-mongodb ×1