{"id":22736743,"url":"https://github.com/mother/mongoose-summarize","last_synced_at":"2026-04-17T12:32:41.911Z","repository":{"id":57302277,"uuid":"70572074","full_name":"mother/mongoose-summarize","owner":"mother","description":"Making denormalization fun (or at least manageable)","archived":false,"fork":false,"pushed_at":"2017-01-19T21:55:12.000Z","size":19,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-01T16:26:06.518Z","etag":null,"topics":["mongodb","mongoose","performance","summarization","summarize"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mother.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-11T08:22:26.000Z","updated_at":"2018-07-29T02:21:07.000Z","dependencies_parsed_at":"2022-09-14T22:54:41.553Z","dependency_job_id":null,"html_url":"https://github.com/mother/mongoose-summarize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mother/mongoose-summarize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mother%2Fmongoose-summarize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mother%2Fmongoose-summarize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mother%2Fmongoose-summarize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mother%2Fmongoose-summarize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mother","download_url":"https://codeload.github.com/mother/mongoose-summarize/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mother%2Fmongoose-summarize/sbom","scorecard":{"id":661180,"data":{"date":"2025-08-11","repo":{"name":"github.com/mother/mongoose-summarize","commit":"3715e31427bde6f89a3cc82f33dd9fb430641eda"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Code-Review","score":1,"reason":"Found 1/7 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T16:15:04.311Z","repository_id":57302277,"created_at":"2025-08-21T16:15:04.312Z","updated_at":"2025-08-21T16:15:04.312Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31929633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["mongodb","mongoose","performance","summarization","summarize"],"created_at":"2024-12-10T22:06:53.271Z","updated_at":"2026-04-17T12:32:41.873Z","avatar_url":"https://github.com/mother.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoose-summarize\n\nWIP\n\nRequires mongoose \u003e= 4.6.5\n\nTo minimize populates and improve query performance, we dereference data that is accessed frequently and is changed seldom.\n\nTo make it very easy to manage dereferenced data, we created a technique and a plugin we call summarization.\n\nTake the User schema for example.\n\n````\nconst UserSchema = new mongoose.Schema({\n\n   email: { type: String, required: true },\n   phone: { type: String },\n   name: {\n      first: { type: String, required: true },\n      last: { type: String, required: true }\n   },\n\n   avatar: {\n      file: { type: Schema.Types.ObjectId, ref: 'file' },\n      url: { type: String } // generated\n   },\n\n   credentials: {\n      encrypted_password: { type: String },\n      reset_request: {\n         code: { type: String, trim: true },\n         date: { type: Date },\n         expires: { type: Date }\n      }\n   },\n\n   ...\n````\n\nWhen other collections contain dereferenced user data, they do not need to store all user data obviously. Let's say only the name and avatar need to be stored. We can use this plugin to only store these fields when the user is being dereferenced (the \"summary\"):\n\n````\nconst UserSummarySchema = new mongoose.Schema({\n   _id: { type: Schema.Types.ObjectId, required: true },\n   name: {\n      first: { type: String, trim: true },\n      last: { type: String, trim: true }\n   },\n   avatar: {\n      url: { type: String }\n   }\n})\n\nmodule.exports = exports = UserSummarySchema\n````\n\nAnd then in the original schema:\n\n````\nUserSchema.plugin(summarize.defineSummarySource)\n````\n\nFor creating the original model from the above schema:\n\n```\nconst UserSchema = require('\u003cPATH_TO_SCHEMAS\u003e/user')\nmongoose.model('user', UserSchema).listenForUpdates()\n```\n\nThen to use the summary in another schema:\n\n````\nconst CommentSchema = new mongoose.Schema({\n   author: UserSummarySchema,\n   body: { type: String },\n   added: {\n      date: { type: Date, default: Date.now }\n   }\n})\n\nCommentSchema.plugin(summarize, { path: 'author', ref: 'user' })\n\nmongoose.model('comment', CommentSchema).listenForSourceChanges()\n````\n\nThis plugin will setup a pub/sub system so that anytime a document in the source collection (eg. users) is updated, the plugin can optionally do batch updates on the schemas that use the summaries to ensure dereferenced data is kept up to date. This should be fairly performant if we setup indeces on the _id path of summary documents.\n\nTODO:\n- [ ] Check schema strictness\n- [ ] Check if relevant paths were actually modified\n- [ ] Autoindex dependencies\n- [ ] Handle mis-syncronization\n- [ ] Deletion of original document: can either delete document containing summary, or update summary, or do nothing\n- [ ] Summarized documents within arrays\n- [ ] Nested Summarizations?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmother%2Fmongoose-summarize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmother%2Fmongoose-summarize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmother%2Fmongoose-summarize/lists"}