{"id":15190576,"url":"https://github.com/sifatullahsu/mongoose-null-error","last_synced_at":"2026-03-03T18:02:54.248Z","repository":{"id":232330814,"uuid":"784064615","full_name":"sifatullahsu/mongoose-null-error","owner":"sifatullahsu","description":"A Mongoose plugin for enforcing validation against null values returned by certain query operations.","archived":false,"fork":false,"pushed_at":"2024-04-09T05:57:05.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-21T18:02:53.471Z","etag":null,"topics":["mongoose","mongoose-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mongoose-null-error","language":"TypeScript","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/sifatullahsu.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-09T05:47:40.000Z","updated_at":"2024-04-09T05:55:57.000Z","dependencies_parsed_at":"2024-04-09T06:50:22.301Z","dependency_job_id":null,"html_url":"https://github.com/sifatullahsu/mongoose-null-error","commit_stats":null,"previous_names":["sifatullahsu/mongoose-null-error"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sifatullahsu/mongoose-null-error","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifatullahsu%2Fmongoose-null-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifatullahsu%2Fmongoose-null-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifatullahsu%2Fmongoose-null-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifatullahsu%2Fmongoose-null-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sifatullahsu","download_url":"https://codeload.github.com/sifatullahsu/mongoose-null-error/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifatullahsu%2Fmongoose-null-error/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30054003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T17:46:22.538Z","status":"ssl_error","status_checked_at":"2026-03-03T17:46:22.036Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["mongoose","mongoose-plugin"],"created_at":"2024-09-27T20:42:18.567Z","updated_at":"2026-03-03T18:02:54.219Z","avatar_url":"https://github.com/sifatullahsu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoose-null-error\n\n`mongoose-null-error` is a plugin for Mongoose that provides functionality to enforce validation against null values returned by certain query operations. It'll throw an error if query return value is null.\n\n## Installation\n\nYou can install `mongoose-null-error` via npm:\n\n```bash\nnpm install mongoose-null-error\n```\n\n```bash\nyarn add mongoose-null-error\n```\n\n## Usage\n\nTo use `mongoose-null-error`, apply the plugin to your Mongoose schema definition and pass the desired options when performing query operations.\n\n```typescript\nimport mongoose from 'mongoose'\nimport mongooseNullError from 'mongoose-null-error'\n\n// Define your Mongoose schema\nconst MySchema = new mongoose.Schema({\n  // Define your schema fields\n})\n\n// Apply the mongoose-null-error plugin to your schema\nMySchema.plugin(mongooseNullError)\n\n// Define your Mongoose model\nconst MyModel = mongoose.model('MyModel', MySchema)\n```\n\n## Performing Query Operations\n\nWhen performing query operations such as `findOne`, `findById`, `findByIdAndUpdate`,`findOneAndUpdate`, `findByIdAndDelete`, `findOneAndDelete`, or `findOneAndReplace`, you can pass an option to enable null error validation.\n\n```typescript\n// Example usage with findById\ntry {\n  const user = await User.findById(id, '', { mongooseNullError: true })\n  // Handle successful query\n} catch (error) {\n  // Handle error thrown due to null value\n  console.error(error.message)\n}\n```\n\nWhen the specified query operation returns a null value and the `mongooseNullError` option is set to `true`, an error will be thrown to indicate an invalid request.\n\n## Contributing\n\nWe welcome contributions from the community. If you want to contribute to this project.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contact\n\nFor questions, feedback, or support, please feel free to contact at [personal.sifat@gmail.com](mailto:personal.sifat@gmail.com).\n\n#### Thank you for using Mongoose Null Error!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsifatullahsu%2Fmongoose-null-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsifatullahsu%2Fmongoose-null-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsifatullahsu%2Fmongoose-null-error/lists"}