{"action":"opened","issue":{"url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1006","repository_url":"https://api.github.com/repos/mbdavid/LiteDB","labels_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1006/labels{/name}","comments_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1006/comments","events_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1006/events","html_url":"https://github.com/mbdavid/LiteDB/issues/1006","id":332066450,"node_id":"MDU6SXNzdWUzMzIwNjY0NTA=","number":1006,"title":"Nested or Hierarchical Data Setup","user":{"login":"vanivk","id":16716754,"node_id":"MDQ6VXNlcjE2NzE2NzU0","avatar_url":"https://avatars0.githubusercontent.com/u/16716754?v=4","gravatar_id":"","url":"https://api.github.com/users/vanivk","html_url":"https://github.com/vanivk","followers_url":"https://api.github.com/users/vanivk/followers","following_url":"https://api.github.com/users/vanivk/following{/other_user}","gists_url":"https://api.github.com/users/vanivk/gists{/gist_id}","starred_url":"https://api.github.com/users/vanivk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanivk/subscriptions","organizations_url":"https://api.github.com/users/vanivk/orgs","repos_url":"https://api.github.com/users/vanivk/repos","events_url":"https://api.github.com/users/vanivk/events{/privacy}","received_events_url":"https://api.github.com/users/vanivk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-13T16:13:55Z","updated_at":"2018-06-13T16:13:55Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\nI am new to NoSQL structure and working on LiteDB to insert nested or hierarchical data. I was able to insert the data as per my requirement, now my issue is to query all of them together. Here is the code I wrote. Can anyone please help me.\r\n```\r\nvar mapper = BsonMapper.Global;\r\nmapper.Entity<Worksheet>().DbRef(x => x.Nodes, \"nodes\");\r\nmapper.Entity<Nodes>().DbRef(x => x.Deviations, \"deviations\");\r\nmapper.Entity<Deviations>().DbRef(x => x.Causes, \"causes\");\r\nmapper.Entity<Causes>().DbRef(x => x.Consequences, \"consequences\");\r\nmapper.Entity<Consequence>().DbRef(x => x.Safeguards, \"safeguards\");\r\n\r\nusing (var db = new LiteDatabase(\"Filename=E:\\\\db\\\\hazopentry.db\"))\r\n\t\t\t{\r\n\t\t\t\tvar collection = db.GetCollection<HazopWorksheet>(\"hazopworksheet\");\r\n\t\t\t\t//var query = collection.IncludeAll(); stuck here. \r\n\r\n\r\n\t\t\t}\r\n```\r\nBelow are the classes: \r\n```\r\n                public class Worksheet\r\n\t\t{\r\n\t\t\t[BsonId]\r\n\t\t\tpublic string WorkSheetId { get; set; }\r\n\t\t\tpublic string WorkSheetName { get; set; }\r\n\t\t\tpublic List<Nodes> Nodes { get; set; }\r\n\t\t}\r\n\t\tpublic class Nodes { \r\n\t\t\t[BsonId]\r\n\t\t\tpublic string NodeId { get; set; }\r\n\t\t\tpublic string NodeName { get; set; }\r\n\t\t\t[BsonRef(\"worksheet\")]\r\n\t\t\tpublic Worksheet Parent { get; set; }\r\n\t\t\tpublic string DrawingRefNode { get; set; }\r\n\t\t\tpublic List<Deviations> Deviations { get; set; }\r\n\t\t} \r\n\t\tpublic class Deviations\r\n\t\t{\r\n\t\t\t[BsonId]\r\n\t\t\tpublic string DeviationId { get; set; }\r\n\t\t\tpublic string DeviationDesc { get; set; }\r\n\t\t\t[BsonRef(\"nodes\")]\r\n\t\t\tpublic Nodes Parent { get; set; }\r\n\t\t\tpublic List<Causes> Causes { get; set; }\r\n\t\t}\r\n\t\tpublic class Causes\r\n\t\t{\r\n\t\t\t[BsonId]\r\n\t\t\tpublic string CauseId { get; set; }\r\n\t\t\tpublic string CauseDesc { get; set; }\r\n\t\t\t[BsonRef(\"deviations\")]\r\n\t\t\tpublic Deviations Parent { get; set; }\r\n\t\t\tpublic List<Consequence> Consequences { get; set; }\r\n\t\t}\r\n\t\tpublic class Consequence\r\n\t\t{\r\n\t\t\t[BsonId]\r\n\t\t\tpublic string ConsequenceId { get; set; }\r\n\t\t\tpublic string ConsequenceDesc { get; set; }\r\n\t\t\t[BsonRef(\"causes\")]\r\n\t\t\tpublic Causes Parent { get; set; }\r\n\t\t\tpublic List<Safeguard> Safeguards { get; set; }\r\n\t\t}\r\n\t\tpublic class Safeguard\r\n\t\t{\r\n\t\t\t[BsonId]\r\n\t\t\tpublic string SafeguardId { get; set; }\r\n\t\t\tpublic string SafeguardDesc { get; set; }\r\n\t\t\t[BsonRef(\"consequences\")]\r\n\t\t\tpublic Consequence Parent { get; set; }\r\n\t\t}\r\n```\r\n\r\n"}}
{"actor":{"display_login":"vanivk"}}