Mongodb inserts one more document if I edit particular field such as flag like "email sent" ? corresponding JAVA POJO class has issue?

huangapple 未分类评论46阅读模式
英文:

Mongodb inserts one more document if I edit particular field such as flag like "email sent" ? corresponding JAVA POJO class has issue?

问题

MongoDB如果我编辑特定字段,例如"email sent"标志,会插入一个额外的文档吗?可能的问题是什么?对应的JAVA POJO类是否有问题?

英文:

Mongodb inserts one more document if I edit particular field such as flag like "email sent" ? what can be the issue ? corresponding JAVA POJO class has issue?

答案1

得分: -1

是的,POJO原本没有将@Id标记的ID作为JAVA类中的一项。在使用@Id注释添加ID属性后,同一文档被修改,而不是在集合中添加新文档。

英文:

Yes, POJO was not having @Id marked ID as one of the item in JAVA class. After Adding ID property with @Id annotation, same document was getting modified instead of adding new document in collection.

huangapple
  • 本文由 发表于 2020年7月26日 11:42:17
  • 转载请务必保留本文链接:https://java.coder-hub.com/63095859.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定