SpringBoot整合MongoDB(3)
1. 索引注解
1-1. @Indexed
@Indexed
private String uid;1-2. @GeoSpatialIndexed
1-3. @TextIndexed
1-4. @CompoundIndex
@Document(collection="users")
@CompoundIndexes({
@CompoundIndex(name = "age_idx", def = "{'name': 1, 'age': -1}")
})
public class Users implements Serializable{
private static final long serialVersionUID = 1L;
...省略代码2. 其他注解
2-1. @Document
2-2. @Id
2-3. @Transient
2-4. @Field
2-5. @DBRef
2-6. @PersistenceConstructor
3. 范例
Last updated
Was this helpful?