Open lawaks opened 10 years ago
I am not sure if this is the same issue, but I run into problems when I wanted to represent a DMS-like recursive structure of folders using the same parent-child association that you describe. I was not able to use JayData to populate the database with entities; I had to use the MongoDB API to create the documents with the necessary ID
and DBRef
properties. Exposing the database in an OData service provided by the ODataServer to query its contents worked.
If you define your data model with relationships using the classic inverse property paradigm, then it won't be possible to retrieve the entity using an "include relationship" if mongoDB is used as a provider where nested relationship is used instead of DB reference. For example: 1) Parent: parent Attribute... parentChildren: inverse relation definition
Child: Child Attribute.. childParent: inverser relation definition
2) In MongoDB, insert parentChildren as a nested relationships. (i.e. db.save({parentAttribute:value, parentChildren:[child1, child2]})
3) In JayData, this won't work: db.Parent.include('parentChildren').toArray(); The parentChildren array will always be empty.
If nested relations is used in mongoDB, then you cannot mark parentChildren as a navigation property (inverse relation) in JayData model. As a result, your model definition is coupled with your data provider.