{"id":23030007,"url":"https://github.com/vpavel04/db-repository-mongo","last_synced_at":"2026-04-12T05:34:35.160Z","repository":{"id":51923144,"uuid":"198777160","full_name":"vpavel04/db-repository-mongo","owner":"vpavel04","description":"mongoDB implementation for db-repository","archived":false,"fork":false,"pushed_at":"2021-05-09T01:53:29.000Z","size":29,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-06T15:25:22.411Z","etag":null,"topics":["database","mongodb","repository-pattern","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/vpavel04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T07:07:16.000Z","updated_at":"2021-01-19T20:24:10.000Z","dependencies_parsed_at":"2022-08-23T18:30:57.744Z","dependency_job_id":null,"html_url":"https://github.com/vpavel04/db-repository-mongo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vpavel04/db-repository-mongo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vpavel04%2Fdb-repository-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vpavel04%2Fdb-repository-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vpavel04%2Fdb-repository-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vpavel04%2Fdb-repository-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vpavel04","download_url":"https://codeload.github.com/vpavel04/db-repository-mongo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vpavel04%2Fdb-repository-mongo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31705574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T05:11:36.334Z","status":"ssl_error","status_checked_at":"2026-04-12T05:11:27.332Z","response_time":58,"last_error":"SSL_read: 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":["database","mongodb","repository-pattern","typescript"],"created_at":"2024-12-15T14:18:07.389Z","updated_at":"2026-04-12T05:34:35.145Z","avatar_url":"https://github.com/vpavel04.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Db-Repository-Mongo\n\nDb-Repository-Mongo is a mongoDb implementation for [Db-Repository](https://github.com/vpavel04/db-repository) in TypeScript\n\n# How to use it\n\n```\nnpm install --save 'db-repository';\nnpm install --save 'db-repository-mongo';\n```\n\nSample code\n```\n// store mongoDbUri in MONGODB_PATH env variable.\nprocess.env.MONGODB_PATH = 'mongoDb uri';\n\nimport * as db from 'db-repository';\nimport * as mongoDbRepo from 'db-repository-mongo';\n\ndb.use(mongoDbRepo.init());\n\n// define new type that works with IRepository\ninterface DbTest extends db.IDbObject {\n    test: string;\n}\n\nconst testFn = async () =\u003e {\n\n  const dbObject: DbTest = \u003cDbTest\u003e{\n      test: 'text1'\n  }\n\n  // create repository\n  const testRepo: db.IRepository\u003cDbTest\u003e = db.repo\u003cDbTest\u003e({ table: 'test' });\n  \n  // add object\n  await testRepo.add(dbObject);\n  \n  // query all\n  const allObjects = await testRepo.list(db.query().all());\n\n  // query by id\n  const objectById = await testRepo.list(db.query().byId(dbObject._id));\n  \n  // update object\n  dbObject.test = 'text2';\n  const nUpdated = await testRepo.update(dbObject);\n  \n  // delete objects\n  const nDeleted = await testRepo.remove(db.query().all());\n};\n\ntestFn();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvpavel04%2Fdb-repository-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvpavel04%2Fdb-repository-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvpavel04%2Fdb-repository-mongo/lists"}