mongodb中ObjectId查询的结果一直变的问题

image

二者本来应该是相同的值,但是每次查询都在变化,

@Id
@ApiModelProperty(value = "主键")
@Field(value = "_id")
var _id:ObjectId? = null
@NotEmpty(groups = [AddGroup::class], message = "id不能为空")
var id: String? = null

原来是这么记录的,直接改成String

@Id
@ApiModelProperty(value = "主键")
@Field(value = "_id")
var _id:String? = null
@NotEmpty(groups = [AddGroup::class], message = "id不能为空")
var id: String? = null

image

完事

posted @ 2023-02-13 17:47  沙漠皇帝  阅读(76)  评论(0编辑  收藏  举报