Given a 1-ary containment relation, one would expect that when updating the associated entity in the owner end, the former owned entity won't keep a relation to the owner end. This is not the case.
Test
This test exemplifies the situation astestUpdateRefSQLMongoFormerTo fails.
void testUpdateSingleRefSQLMongo(PolystoreInstance p) {
p.runUpdate((Request)`update Biography b where b.@id == #bio1 set {user: #davy}`);
rs = p.runQuery((Request)`from Biography b select b.@id, b.user where b.@id == #bio1`);
p.assertResultEquals("testUpdateRefSQLMongo", rs, <["b.@id", "b.user"], [[ U("bio1"), U("davy")]]>);
rs = p.runQuery((Request)`from User u select u.@id, u.biography where u.@id == #davy`);
p.assertResultEquals("testUpdateRefSQLMongoTo", rs, <["u.@id", "u.biography"], [[ U("davy"), U("bio1")]]>);
rs = p.runQuery((Request)`from User u select u.@id, u.biography where u.@id == #pablo`);
p.assertResultEquals("testUpdateRefSQLMongoFormerTo", rs, <["u.@id", "u.biography"], [[ U("pablo"), {}]]>);
}
Describe the bug
Given a 1-ary containment relation, one would expect that when updating the associated entity in the owner end, the former owned entity won't keep a relation to the owner end. This is not the case.
Test
This test exemplifies the situation as
testUpdateRefSQLMongoFormerTo
fails.To reproduce
Models are at https://github.com/typhon-project/typhonql/tree/dev/typhonql/src/lang/typhonql/test/resources/user-review-product.
Test has been added to test suite on commit https://github.com/typhon-project/typhonql/commit/3fa8a01f7c6d6aa635f1da8b54a7d3cdb981ae18