{"id":15412553,"url":"https://github.com/elmassimo/mongoid_includes","last_synced_at":"2025-04-08T03:10:37.654Z","repository":{"id":35854282,"uuid":"40138894","full_name":"ElMassimo/mongoid_includes","owner":"ElMassimo","description":"🌿 Improves eager loading support for Mongoid","archived":false,"fork":false,"pushed_at":"2024-08-08T23:57:38.000Z","size":145,"stargazers_count":47,"open_issues_count":1,"forks_count":19,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T00:42:35.870Z","etag":null,"topics":["eager-loading","mongoid","performance","queries","rails","ruby"],"latest_commit_sha":null,"homepage":"https://maximomussini.com/posts/mongoid-n+1/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElMassimo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-03T17:37:47.000Z","updated_at":"2024-09-20T22:32:16.000Z","dependencies_parsed_at":"2024-12-04T04:00:53.669Z","dependency_job_id":"6cd83d39-f84e-4a2e-8fa1-86f1400c8aa7","html_url":"https://github.com/ElMassimo/mongoid_includes","commit_stats":{"total_commits":42,"total_committers":6,"mean_commits":7.0,"dds":"0.19047619047619047","last_synced_commit":"631eea62aa8608b4ea16f7604a8ac9550dc8851e"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fmongoid_includes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fmongoid_includes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fmongoid_includes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fmongoid_includes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElMassimo","download_url":"https://codeload.github.com/ElMassimo/mongoid_includes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eager-loading","mongoid","performance","queries","rails","ruby"],"created_at":"2024-10-01T16:53:42.743Z","updated_at":"2025-04-08T03:10:37.635Z","avatar_url":"https://github.com/ElMassimo.png","language":"Ruby","readme":"Mongoid::Includes\n=====================\n[![Gem Version](https://badge.fury.io/rb/mongoid_includes.svg)](http://badge.fury.io/rb/mongoid_includes)\n[![Build Status](https://travis-ci.org/ElMassimo/mongoid_includes.svg)](https://travis-ci.org/ElMassimo/mongoid_includes)\n[![Test Coverage](https://codeclimate.com/github/ElMassimo/mongoid_includes/badges/coverage.svg)](https://codeclimate.com/github/ElMassimo/mongoid_includes)\n[![Code Climate](https://codeclimate.com/github/ElMassimo/mongoid_includes.svg)](https://codeclimate.com/github/ElMassimo/mongoid_includes)\n[![Inline docs](http://inch-ci.org/github/ElMassimo/mongoid_includes.svg)](http://inch-ci.org/github/ElMassimo/mongoid_includes)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ElMassimo/mongoid_includes/blob/main/LICENSE.txt)\n\n`Mongoid::Includes` improves eager loading in Mongoid, supporting polymorphic associations, and nested eager loading.\n\n### Usage\n\n```ruby\nAlbum.includes(:songs).includes(:musicians, from: :band)\n\nBand.includes(:albums, with: -\u003e(albums) { albums.gt(release: 1970) })\n\n# The library supports nested eager loading using :from for terseness,\n# but you can manually include nested associations using the :with option.\nreleased_only = -\u003e(albums) { albums.where(released: true) }\nMusician.includes(:band, with: -\u003e(bands) { bands.limit(2).includes(:albums, with: released_only) })\n```\n\n### Pro Tip\nSince you can modify the queries for the associations, you can use `only` and make your queries even faster:\n```ruby\nBand.includes :musicians, with: -\u003e(musicians) { musicians.only(:id, :name) }\n```\n\n## Advantages\n\n* [Avoid N+1 queries](http://maximomussini.com/posts/mongoid-n+1/) and get better performance.\n* No boilerplate code is required.\n* Modify the queries for related documents at will.\n\n## Installation\n\nAdd this line to your application's Gemfile and run `bundle install`:\n\n```ruby\n  gem 'mongoid_includes'\n```\n\nOr install it yourself running:\n\n```sh\ngem install mongoid_includes\n```\n\nLicense\n--------\n\n    Copyright (c) 2015 Máximo Mussini\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    \"Software\"), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmassimo%2Fmongoid_includes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felmassimo%2Fmongoid_includes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmassimo%2Fmongoid_includes/lists"}