MongoDB Embedded Objects have no ID (null value)

后端 未结 4 1181
执念已碎
执念已碎 2020-12-08 07:16

I have a question regarding MongoDB with Spring Data. I have these domain classes:

@Document
public class Deal  {
    @Id
    private ObjectId _id;
    priv         


        
4条回答
  •  抹茶落季
    2020-12-08 07:49

    An _id is not set on subdocuments by default only on root docuemnts.

    You will need to define a _id for your subdocuments on insert and update.

提交回复
热议问题