You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
entity Product {
id : String
orders -> Order[1]
}
entity Order {
id : String
products -> Product."Product.orders"[1]
}
documentdb DocumentDatabase {
collections {
Order : Order
Product : Product
}
}
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:
I executed this insert statement: insert Product {id: "p", orders: Order {id: "o"}}
I secondly executed this one (in the inverse sense): insert Order {id:"o2", products: Product {id: "p2"}}
I executed this select query: from Product p, Order o select p, o where p.orders == o
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
The text was updated successfully, but these errors were encountered:
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:
insert Product {id: "p", orders: Order {id: "o"}}
insert Order {id:"o2", products: Product {id: "p2"}}
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
The text was updated successfully, but these errors were encountered: