Closed ptwohig closed 2 years ago
This actually seems to work correctly in 2.2.6 with your reproducer. Can you upgrade and give that a try?
@evanchooly Looks like it passes for me. Now with 2.2.6 I'm getting a different issue in production code. I"ll check on my end and make a new reproducer test if it seems to be a problem with Morphia.
closing this since this issue seems ok. please open a new one if you find something else.
Describe the bug NPE when trying to use unset in combination with modify() when the field is annotated with
@Reference
.To Reproduce Steps to reproduce the behavior:
@Entity
annotated classFoo
that has an@Id
annotated field.@Entity
annotated classBar
that has an@Id
annotated field and a@Reference
annotated field of typeFoo
Bar
with with a null reference toFoo
and save it to the database. Allow Morphia to assign ID and leave all references toFoo
asnull
.Query.modify().execute(new ModifyOptions())
attempt to unset the blank field using unset operatorExpected behavior The operation succeeds, or Morphia throws a meaningful exception.
Please complete the following information:
Additional context
Stack trace: