{"action":"created","issue":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/7944","repository_url":"https://api.github.com/repos/jhipster/generator-jhipster","labels_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/7944/labels{/name}","comments_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/7944/comments","events_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/7944/events","html_url":"https://github.com/jhipster/generator-jhipster/issues/7944","id":339548326,"node_id":"MDU6SXNzdWUzMzk1NDgzMjY=","number":7944,"title":"Support for rich document models for mongodb (embedding and referencing)","user":{"login":"ivangsa","id":1246876,"node_id":"MDQ6VXNlcjEyNDY4NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/1246876?v=4","gravatar_id":"","url":"https://api.github.com/users/ivangsa","html_url":"https://github.com/ivangsa","followers_url":"https://api.github.com/users/ivangsa/followers","following_url":"https://api.github.com/users/ivangsa/following{/other_user}","gists_url":"https://api.github.com/users/ivangsa/gists{/gist_id}","starred_url":"https://api.github.com/users/ivangsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivangsa/subscriptions","organizations_url":"https://api.github.com/users/ivangsa/orgs","repos_url":"https://api.github.com/users/ivangsa/repos","events_url":"https://api.github.com/users/ivangsa/events{/privacy}","received_events_url":"https://api.github.com/users/ivangsa/received_events","type":"User","site_admin":false},"labels":[{"id":778903973,"node_id":"MDU6TGFiZWw3Nzg5MDM5NzM=","url":"https://api.github.com/repos/jhipster/generator-jhipster/labels/$100","name":"$100","color":"FFBF00","default":false},{"id":241999106,"node_id":"MDU6TGFiZWwyNDE5OTkxMDY=","url":"https://api.github.com/repos/jhipster/generator-jhipster/labels/feature%20request","name":"feature request","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":23,"created_at":"2018-07-09T17:54:23Z","updated_at":"2018-09-10T08:16:10Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\n\r\nI would like to add support for rich documents a relations for mongodb to jhipster\r\n\r\nI think it would be easy to add support for both embedded/nested objects and collections as well as references between entities\r\n\r\nI've been doing some work but I'm quite new to js development and I'm stuck with debugging some errors and finding my way with mocha tests..\r\n\r\nhttps://github.com/ivangsa/generator-jhipster/issues/1\r\n\r\nLet me know what you think about this...\r\n\r\nRegards\r\nIvan\r\n\r\n------\r\n\r\nI would like to implement support for entity relations with mongodb, to generate microserices from jdl to cover two use cases:\r\n\r\n1.- Support complex document models: embedded and nested objects and collections.\r\n2.- Support documents with relations using @DBRef\r\n\r\nI think the JDL would need extending to acommodote both embedding and referencing... Allow adding fields with an entity as fieldType, very much as the Enums are defined now, using jpa @Embeddable/@Embedded as field configuration for sql backend, benefiting sql backend as well as mongodb.\r\n    entity Person {\r\n        name String,\r\n        address Address\r\n    }\r\n    entity Address { ... }\r\n    \r\n(There is a small problem when using @Embeddable/@Embedded is not posible mark the embedded Id as transient, but small tweaks on generated code can acomodate the mappings for exact needs..)\r\n\r\n\r\nThis is how I'm planning to interpret the JDL as it is right now plus the 'embedded field' extension:\r\n\r\n#### Embedded (for embedding entities)\r\n- Unidirectional: @Field (@Embeddable/@Embedded for sql)\r\n    entity Person {\r\n        name String,\r\n        address Address\r\n    }\r\n    entity Address { ... }\r\n\r\n#### One-to-One (for entities references)\r\n\r\n- Bidirectional: @DBRef for both left and right side fields. @JsonBackReference on right side.\r\n    relationship OneToOne {\r\n      Car{driver} to Driver{car}\r\n    }\r\n- Unidirectional: @DBRef on left side\r\n    relationship OneToOne {\r\n      Citizen{passport} to Passport\r\n    }\r\n    \r\n\r\n#### One-to-Many \r\n(Owner has none, one or more Cars) For embedding collections of entities with backreference.\r\n- Bidirectional: @Field for left side, @DBRef for right side. @JsonBackReference on the non-collection (right) side.\r\n    relationship OneToMany {\r\n      Owner{car} to Car{owner}\r\n    }\r\n- Unidirectional: (not supported)\r\n\r\n#### Many-to-One\r\n- Bidirectional: For embedding collections of references: @DBRef on both sides. @JsonBackReference on the non-collection side.\r\n    relationship ManyToOne {\r\n      Car{owner} to Owner{car}\r\n    }\r\n- Unidirectional (where the car know its owner): @DBRef on the left side field.\r\n    relationship ManyToOne {\r\n      Car{owner} to Owner\r\n    }\r\n\r\n#### Many-to-Many\r\n- Bidirectional: using @DBRef on both sides. Not sure about @JsonBackReference/@JsonIgnore of how much sense does it make.\r\n    relationship ManyToMany {\r\n      Car{driver} to Driver{car}\r\n    }\r\n    \r\n\r\nI believe this would cover a wide range of posibilities for generating rich document models for mongodb microservices.\r\n\r\nI found this was proposed before but not work was done yet..\r\nhttps://github.com/jhipster/generator-jhipster/issues/4079\r\n- [x] Checking this box is mandatory (this is just to show you read everything)\r\n\r\n<!-- Love JHipster? Please consider supporting our collective:\r\n👉  https://opencollective.com/generator-jhipster/donate -->\r\n"},"comment":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/comments/419827018","html_url":"https://github.com/jhipster/generator-jhipster/issues/7944#issuecomment-419827018","issue_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/7944","id":419827018,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTgyNzAxOA==","user":{"login":"randeepbydesign","id":42743473,"node_id":"MDQ6VXNlcjQyNzQzNDcz","avatar_url":"https://avatars3.githubusercontent.com/u/42743473?v=4","gravatar_id":"","url":"https://api.github.com/users/randeepbydesign","html_url":"https://github.com/randeepbydesign","followers_url":"https://api.github.com/users/randeepbydesign/followers","following_url":"https://api.github.com/users/randeepbydesign/following{/other_user}","gists_url":"https://api.github.com/users/randeepbydesign/gists{/gist_id}","starred_url":"https://api.github.com/users/randeepbydesign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randeepbydesign/subscriptions","organizations_url":"https://api.github.com/users/randeepbydesign/orgs","repos_url":"https://api.github.com/users/randeepbydesign/repos","events_url":"https://api.github.com/users/randeepbydesign/events{/privacy}","received_events_url":"https://api.github.com/users/randeepbydesign/received_events","type":"User","site_admin":false},"created_at":"2018-09-10T08:16:10Z","updated_at":"2018-09-10T08:16:10Z","author_association":"NONE","body":"I had considered that but I don't think it will work because it doesn't explicitly block entities and daos from being created. I guess we could check to see if no entities belong to the left side of a relationship and infer that status but that seems kind of hacky and might cause other problems "}}
{"actor":{"display_login":"randeepbydesign"}}