Open meuriceloup opened 4 years ago
The code around relationships is changing this week, so I hope the bug will be gone then. We'll check again next week.
Hi @meuriceloup , thanks for the report. Could you try this in the current compiler as follows:
insert Order {@id: #o}
insert Product {@id: #p, orders: #o }
and then:
insert Product {@id: #p2}
insert Order {@id: #o2, products: #p2 }
(NB: your relation names are plural, but the cardinality is single, which is a bit confusing)
Hi,
This is the deployed TML schema:
In this schema, there are two defined entities declared in the documentdb. In addition, a 1-1 opposite relationship is defined between both entities. However, it seems that the polystore handles this opposite relationship as two simple unrelated relationships. Scenario:
1) I executed this insert statement:
insert Product {id: "p", orders: Order {id: "o"}}
2) I secondly executed this one (in the inverse sense):insert Order {id:"o2", products: Product {id: "p2"}}
3) I executed this select query:from Product p, Order o select p, o where p.orders == o
However, it only returns this:
it was supposed to return (o2, p2) as well, since an opposite relationship is defined. For obtaining the complete results: I had to execute this QL query:
from Product p, Order o select p, o where o.products == p || p.orders == o
I then took a look at the MongoDB structures and the stored data and, indeed, the opposite relationship seems to be handled as two different relationships... This is what the MongoDB looks:
In first image, field 'Order.product' is used to store relationship (o2, p2). In second image, field 'Product.orders' is used to store relationship (o,p).
This way to handle the opposite relation seems equivalent to handling two different relationships and it causes the incomplete results when executing this QL query:
from Product p, Order o select p, o where p.orders == o