{"id":766,"date":"2017-11-14T20:00:43","date_gmt":"2017-11-14T18:00:43","guid":{"rendered":"https:\/\/qappdesign.com\/code\/?p=766"},"modified":"2017-11-15T07:56:30","modified_gmt":"2017-11-15T05:56:30","slug":"mongodb-and-linq-how-to-aggregate-and-join-collections","status":"publish","type":"post","link":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/","title":{"rendered":"MongoDb and LINQ: How to aggregate and join collections"},"content":{"rendered":"<p>Data aggregations are very helpful whenever you need to create metrics or get more insights from the data. Furthermore, joining multiple MongoDb collections may provide more meaningful results. This article will be a light intro on how to do run these on MongoDb using .NET Driver and LINQ. <\/p>\n<h4>Notes before starting<\/h4>\n<p>This article is the 3rd article, continuing <a href=\"https:\/\/qappdesign.com\/code\/search-best-places-mongodb-linq-netcore\/\" rel=\"noopener\" target=\"_blank\">Part 1: How to search good places to travel (MongoDb LINQ &amp; .NET Core)<\/a>, and <a href=\"https:\/\/qappdesign.com\/code\/paging-mongodb-avoid-poor-performance\/\" rel=\"noopener\" target=\"_blank\">Part 2: Paging in MongoDB \u2013 How to actually avoid poor performance ?<\/a>. All share the same GitHub project, each of them having specific code methods. Please follow the steps presented in Part 1 on how to install and configure MongoDb, as well as, the section about the initial data upload.<\/p>\n<h4>To install<\/h4>\n<p>Here are all the things needed to be installed:<\/p>\n<ul>\n<li><a href=\"http:\/\/visualstudio.com\/free\" target=\"_blank\">Visual Studio Community 2017<\/a>, including .NET Core option<\/li>\n<li><a href=\"https:\/\/www.mongodb.com\/download-center#community\" target=\"_blank\">MongoDB<\/a> and <a href=\"https:\/\/robomongo.org\/\" target=\"_blank\">Robomongo<\/a><\/li>\n<\/ul>\n<h4>Run project<\/h4>\n<p>In brief, once the MongoDb installation is complete, run the next steps:<\/p>\n<ul>\n<li>Clone or download the project (<a href=\"https:\/\/github.com\/fpetru\/WebApiQueryMongoDb\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/fpetru\/WebApiQueryMongoDb<\/a>)<\/li>\n<li>Run the <em>import.cmd<\/em> from Data\\Import folder<\/li>\n<li>Open solution in Visual Studio, compile and run<\/li>\n<\/ul>\n<h4>GroupBy in MongoDb<\/h4>\n<p>MongoDb has for a long time an aggregation framework and with the .NET Driver, and its features fit nice into standard LINQ operators (such as: $project => Select(), $limit => Take(), $match => Where() etc.). <strong>LINQ<\/strong> is ideally suited to building up a pipeline of operations and to submit to the server as a single command. <\/p>\n<p>In our example, grouping by <em>City<\/em>, and finding all available travel items would look like this:<\/p>\n<pre>\r\npublic async Task&lt;IEnumerable&lt;object&gt;&gt; GetTravelDestinations(string cityName)\r\n{\r\n    var groupTravelItemsByCity = _context.TravelItems.AsQueryable()\r\n                .Where(city =&gt; string.IsNullOrEmpty(cityName) \r\n\t\t\t\t\t\t|| city.City.Contains(cityName))\r\n                .GroupBy(s =&gt; new { s.City })\r\n                .Select(n =&gt; new\r\n                {\r\n                    value = n.Key.City,\r\n                    data = n.Count()\r\n                });\r\n\r\n    return await groupTravelItemsByCity.Take(100).ToListAsync();\r\n}\r\n<\/pre>\n<p>The results are made available to external applications using the Get function from controller:<\/p>\n<pre>\r\n\/\/ GET api\/Display\/GroupBy?city=CityName\r\n[NoCache]\r\n[HttpGet(&quot;{type}&quot;)]\r\npublic async Task&lt;IActionResult&gt; Get(string type, [FromQuery]string city)\r\n{\r\n\tif (!string.IsNullOrEmpty(city) &amp;&amp; city.Length &gt; 1) \r\n\t\treturn Ok(await _displayRepository.GetTravelDestinations(city));\r\n\r\n\treturn NotFound();\r\n}\r\n<\/pre>\n<p>I have used IActionResult interface to be able to return 404 in case the request does not follow the requirements: <em>city<\/em> needs to be provided, with a minimum lenght of 2 characters. <\/p>\n<h4>More about aggregation in MongoDb<\/h4>\n<p>All standard LINQ to SQL aggregate operators are supported: Average, Count, Max, Min, and Sum. We could also <em>group by<\/em> using more attributes. Here is an example, grouping first after <em>City<\/em> and then after each associated <em>Action<\/em>, and also using the aggregate functions (like <em>Count<\/em>, <em>Max<\/em> and <em>Min<\/em>):<\/p>\n<pre>\r\npublic async Task&lt;IEnumerable&lt;object&gt;&gt; GetTravelItemStat()\r\n{\r\n\tvar groupTravelItemsByCityAndAction = _context.TravelItems.AsQueryable()\r\n\t\t\t\t.Where(s =&gt; s.City == &quot;Paris&quot; || s.City == &quot;Berlin&quot;)\r\n\t\t\t\t.GroupBy(s =&gt; new { s.City, s.Action })\r\n\t\t\t\t.Select(n =&gt; new\r\n\t\t\t\t{\r\n\t\t\t\t\tLocation = n.Key,\r\n\t\t\t\t\tCount = n.Count(),\r\n\t\t\t\t\tMaxPrice = n.Max(p =&gt; p.Price),\r\n\t\t\t\t\tMinPrice = n.Min(p =&gt; p.Price)\r\n\t\t\t\t});\r\n\r\n\treturn await groupTravelItemsByCityAndAction.Take(100).ToListAsync();\r\n}\r\n<\/pre>\n<h4>Join support from MongoDb<\/h4>\n<p>Here is an example of running a join between 2 collections, using the LINQ as a query expression. It is a LEFT join query, starting with the first (left-most) collection (<em>TravelItems<\/em>) and then matching second (right-most) collection (<em>CityExtended<\/em>). <\/p>\n<p>This means that it filters resultant items (<em>CityExtended<\/em>). The overall result could be projected in an anonymous type (our example below), or in a new entity:<\/p>\n<pre>\r\npublic async Task&lt;IEnumerable&lt;object&gt;&gt; GetTravelItemsOfCityAsync(string cityName)\r\n{\r\n\tvar query = from travelItem in _context.TravelItems.AsQueryable()\r\n\t\t\t\tjoin city in _context.CityExtended.AsQueryable()\r\n\t\t\t\t   on travelItem.City equals city.Name\r\n\t\t\t\tinto CityExtendedMatchingItems\r\n\t\t\t\twhere (travelItem.City == cityName)\r\n\t\t\t\tselect new\r\n\t\t\t\t{\r\n\t\t\t\t\tAction = travelItem.Action,\r\n\t\t\t\t\tName = travelItem.Name,\r\n\t\t\t\t\tFirstCityMatched = CityExtendedMatchingItems.First(),\r\n\t\t\t\t};\r\n\r\n\treturn await query.Take(10).ToListAsync();\r\n}\r\n<\/pre>\n<h4>Access the WebApi using Javascript<\/h4>\n<p>Accessing the webapi from a simple static HTML with javascript, could look like this:<br \/>\n<img src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif\" alt=\"\" class=\"lazyload \" \/><noscript><img src=\"https:\/\/i0.wp.com\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif?w=960&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\" \/><\/noscript><\/p>\n<p>In order to make available a html file within the project, we would need first to enable the access to the static files (e.g. html, css, images). These are typically located in the web root (<content-root>\/wwwroot) folder. For development, we could set this as project&#8217;s web root &#8211; see method (<em>UseContentRoot<\/em>):<\/p>\n<pre>\r\npublic static IWebHost BuildWebHost(string[] args) =&gt;\r\n\tWebHost.CreateDefaultBuilder(args)\r\n\t\t.UseContentRoot(Directory.GetCurrentDirectory())\r\n\t\t.UseStartup&lt;Startup&gt;()\r\n\t\t.Build();\r\n<\/pre>\n<p>In order for static files to be served, we also need to configure the Middleware to add static files to the pipeline. <\/p>\n<pre>\r\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env)\r\n{\r\n    \/\/ ...\r\n    app.UseStaticFiles();\r\n    \/\/ ... \r\n}\r\n<\/pre>\n<p>Once the static files are enabled, we will use jQuery library to access the WebApi, and also to display the results (with the autocomplete widget). This code was originally available from: <a href=\"https:\/\/designshack.net\/articles\/javascript\/create-a-simple-autocomplete-with-html5-jquery\/\">https:\/\/designshack.net\/articles\/javascript\/create-a-simple-autocomplete-with-html5-jquery<\/a>).<\/p>\n<p>Here is the full javascript code for both autocomplete function, and WebApi server calling.<\/p>\n<pre>\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n    $(document).ready(function () {\r\n        $('#autocomplete').autocomplete({\r\n            minLength: 2,\r\n            source: function (request, response) {\r\n                var webApiUrl = '.\/api\/display\/GroupBy' + '?city=' + request.term;\r\n                $.getJSON(webApiUrl, request, function (data, status, xhr) {\r\n                    response(data);\r\n                });\r\n            },\r\n        });\r\n    });\r\n&lt;\/script&gt;\r\n<\/pre>\n<h4>You might be interested also<\/h4>\n<ul>\n<li>Part 1 &#8211; Run LINQ queries with MongoDB &#8211; <a href=\"https:\/\/qappdesign.com\/code\/search-best-places-mongodb-linq-netcore\/\" target=\"_blank\">How to search good places to travel (MongoDb LINQ &amp; .NET Core)<\/a><\/li>\n<li><a href=\"https:\/\/qappdesign.com\/code\/paging-mongodb-avoid-poor-performance\/\">Part 2 &#8211; Paging in MongoDB \u2013 How to actually avoid poor performance ?<\/a><\/li>\n<li><a href=\"https:\/\/qappdesign.com\/code\/using-mongodb-with-net-core-webapi\/\" target=\"_blank\">Using MongoDB .NET Driver with .NET Core WebAPI<\/a><\/li>\n<li><a href=\"https:\/\/qappdesign.com\/code\/mongodb-aspnetmvc-core\/\">Using MongoDB .NET Driver with ASP.NET Core MVC<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Data aggregations are very helpful whenever you need to create metrics or get more insights from the data. Furthermore, joining multiple MongoDb collections may provide more meaningful results. This article will be a light intro on how to do run these on MongoDb using .NET Driver and LINQ. Notes before starting This article is the 3rd article, continuing Part 1: How to search good places to travel (MongoDb LINQ &amp; .NET Core), and Part 2: Paging in MongoDB \u2013 How to actually avoid poor performance ?. All share the same GitHub project, each of them having specific code methods. Please follow the steps presented in Part 1 on how to install and configure MongoDb, as well as, the section about the initial data upload. To install Here are all the things needed to be installed: Visual Studio Community 2017, including .NET Core option MongoDB and Robomongo Run project In brief, once the MongoDb installation is complete, run the next steps: Clone or download the project (https:\/\/github.com\/fpetru\/WebApiQueryMongoDb) Run the import.cmd from Data\\Import folder Open solution in Visual Studio, compile and run GroupBy in MongoDb MongoDb has for a long time an aggregation framework and with the .NET Driver, and its features [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"MongoDb and LINQ: How to aggregate and join collections","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[13,6,7,12,8],"tags":[22,3,25,24],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MongoDb and LINQ: How to aggregate and join collections - Cloud, Data and Integrations<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MongoDb and LINQ: How to aggregate and join collections - Cloud, Data and Integrations\" \/>\n<meta property=\"og:description\" content=\"Data aggregations are very helpful whenever you need to create metrics or get more insights from the data. Furthermore, joining multiple MongoDb collections may provide more meaningful results. This article will be a light intro on how to do run these on MongoDb using .NET Driver and LINQ. Notes before starting This article is the 3rd article, continuing Part 1: How to search good places to travel (MongoDb LINQ &amp; .NET Core), and Part 2: Paging in MongoDB \u2013 How to actually avoid poor performance ?. All share the same GitHub project, each of them having specific code methods. Please follow the steps presented in Part 1 on how to install and configure MongoDb, as well as, the section about the initial data upload. To install Here are all the things needed to be installed: Visual Studio Community 2017, including .NET Core option MongoDB and Robomongo Run project In brief, once the MongoDb installation is complete, run the next steps: Clone or download the project (https:\/\/github.com\/fpetru\/WebApiQueryMongoDb) Run the import.cmd from Data\\Import folder Open solution in Visual Studio, compile and run GroupBy in MongoDb MongoDb has for a long time an aggregation framework and with the .NET Driver, and its features [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloud, Data and Integrations\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-14T18:00:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-15T05:56:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@qappdesign\" \/>\n<meta name=\"twitter:site\" content=\"@QAppDesign\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Petru Faurescu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/qappdesign.com\/code\/#website\",\"url\":\"https:\/\/qappdesign.com\/code\/\",\"name\":\"QualityAppDesign\",\"description\":\"with Petru Faurescu\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/qappdesign.com\/code\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/i0.wp.com\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif?fit=758%2C591&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif?fit=758%2C591&ssl=1\",\"width\":758,\"height\":591},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#webpage\",\"url\":\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/\",\"name\":\"MongoDb and LINQ: How to aggregate and join collections - Cloud, Data and Integrations\",\"isPartOf\":{\"@id\":\"https:\/\/qappdesign.com\/code\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#primaryimage\"},\"datePublished\":\"2017-11-14T18:00:43+00:00\",\"dateModified\":\"2017-11-15T05:56:30+00:00\",\"author\":{\"@id\":\"https:\/\/qappdesign.com\/code\/#\/schema\/person\/54db90dc6fe846cfd4c5a9544d93b75a\"},\"breadcrumb\":{\"@id\":\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/qappdesign.com\/code\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MongoDb and LINQ: How to aggregate and join collections\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/qappdesign.com\/code\/#\/schema\/person\/54db90dc6fe846cfd4c5a9544d93b75a\",\"name\":\"Petru Faurescu\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/qappdesign.com\/code\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/84fb359a4e3d583dbea5a34bd5566956?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/84fb359a4e3d583dbea5a34bd5566956?s=96&d=mm&r=g\",\"caption\":\"Petru Faurescu\"},\"description\":\"Product lead, software developer &amp; architect\",\"sameAs\":[\"https:\/\/qappdesign.com\/code\",\"https:\/\/www.linkedin.com\/in\/petrufaurescu\/\",\"https:\/\/twitter.com\/@qappdesign\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MongoDb and LINQ: How to aggregate and join collections - Cloud, Data and Integrations","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/","og_locale":"en_US","og_type":"article","og_title":"MongoDb and LINQ: How to aggregate and join collections - Cloud, Data and Integrations","og_description":"Data aggregations are very helpful whenever you need to create metrics or get more insights from the data. Furthermore, joining multiple MongoDb collections may provide more meaningful results. This article will be a light intro on how to do run these on MongoDb using .NET Driver and LINQ. Notes before starting This article is the 3rd article, continuing Part 1: How to search good places to travel (MongoDb LINQ &amp; .NET Core), and Part 2: Paging in MongoDB \u2013 How to actually avoid poor performance ?. All share the same GitHub project, each of them having specific code methods. Please follow the steps presented in Part 1 on how to install and configure MongoDb, as well as, the section about the initial data upload. To install Here are all the things needed to be installed: Visual Studio Community 2017, including .NET Core option MongoDB and Robomongo Run project In brief, once the MongoDb installation is complete, run the next steps: Clone or download the project (https:\/\/github.com\/fpetru\/WebApiQueryMongoDb) Run the import.cmd from Data\\Import folder Open solution in Visual Studio, compile and run GroupBy in MongoDb MongoDb has for a long time an aggregation framework and with the .NET Driver, and its features [&hellip;]","og_url":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/","og_site_name":"Cloud, Data and Integrations","article_published_time":"2017-11-14T18:00:43+00:00","article_modified_time":"2017-11-15T05:56:30+00:00","og_image":[{"url":"https:\/\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif"}],"twitter_card":"summary","twitter_creator":"@qappdesign","twitter_site":"@QAppDesign","twitter_misc":{"Written by":"Petru Faurescu","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/qappdesign.com\/code\/#website","url":"https:\/\/qappdesign.com\/code\/","name":"QualityAppDesign","description":"with Petru Faurescu","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/qappdesign.com\/code\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#primaryimage","inLanguage":"en-US","url":"https:\/\/i0.wp.com\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif?fit=758%2C591&ssl=1","contentUrl":"https:\/\/i0.wp.com\/qappdesign.com\/code\/wp-content\/uploads\/2017\/11\/LINQ-mongo-groupby2.gif?fit=758%2C591&ssl=1","width":758,"height":591},{"@type":"WebPage","@id":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#webpage","url":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/","name":"MongoDb and LINQ: How to aggregate and join collections - Cloud, Data and Integrations","isPartOf":{"@id":"https:\/\/qappdesign.com\/code\/#website"},"primaryImageOfPage":{"@id":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#primaryimage"},"datePublished":"2017-11-14T18:00:43+00:00","dateModified":"2017-11-15T05:56:30+00:00","author":{"@id":"https:\/\/qappdesign.com\/code\/#\/schema\/person\/54db90dc6fe846cfd4c5a9544d93b75a"},"breadcrumb":{"@id":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/qappdesign.com\/code\/mongodb-and-linq-how-to-aggregate-and-join-collections\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/qappdesign.com\/code\/"},{"@type":"ListItem","position":2,"name":"MongoDb and LINQ: How to aggregate and join collections"}]},{"@type":"Person","@id":"https:\/\/qappdesign.com\/code\/#\/schema\/person\/54db90dc6fe846cfd4c5a9544d93b75a","name":"Petru Faurescu","image":{"@type":"ImageObject","@id":"https:\/\/qappdesign.com\/code\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/84fb359a4e3d583dbea5a34bd5566956?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/84fb359a4e3d583dbea5a34bd5566956?s=96&d=mm&r=g","caption":"Petru Faurescu"},"description":"Product lead, software developer &amp; architect","sameAs":["https:\/\/qappdesign.com\/code","https:\/\/www.linkedin.com\/in\/petrufaurescu\/","https:\/\/twitter.com\/@qappdesign"]}]}},"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p82xvM-cm","_links":{"self":[{"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/posts\/766"}],"collection":[{"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/comments?post=766"}],"version-history":[{"count":33,"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/posts\/766\/revisions"}],"predecessor-version":[{"id":810,"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/posts\/766\/revisions\/810"}],"wp:attachment":[{"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/media?parent=766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/categories?post=766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qappdesign.com\/code\/wp-json\/wp\/v2\/tags?post=766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}