{"id":21166312,"url":"https://github.com/ajyounguk/mongodb-crud-client","last_synced_at":"2025-07-09T17:32:43.506Z","repository":{"id":47651687,"uuid":"123423569","full_name":"ajyounguk/mongodb-crud-client","owner":"ajyounguk","description":"Simple Mongo CRUD client in  node.js for mongoDB ","archived":false,"fork":false,"pushed_at":"2022-12-20T09:33:54.000Z","size":331,"stargazers_count":3,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-17T11:47:40.896Z","etag":null,"topics":["crud","css","demo","example","example-code","express","html","mongodb","mongoose","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ajyounguk.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":"2018-03-01T11:03:37.000Z","updated_at":"2023-09-03T15:14:41.000Z","dependencies_parsed_at":"2023-01-30T00:05:10.841Z","dependency_job_id":null,"html_url":"https://github.com/ajyounguk/mongodb-crud-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajyounguk%2Fmongodb-crud-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajyounguk%2Fmongodb-crud-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajyounguk%2Fmongodb-crud-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajyounguk%2Fmongodb-crud-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajyounguk","download_url":"https://codeload.github.com/ajyounguk/mongodb-crud-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225578719,"owners_count":17491275,"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":["crud","css","demo","example","example-code","express","html","mongodb","mongoose","nodejs"],"created_at":"2024-11-20T14:49:15.322Z","updated_at":"2024-11-20T14:49:15.854Z","avatar_url":"https://github.com/ajyounguk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MongoDB CRUD in Node.js - Example / Demo code\n\n## What is this?\nDemo code that excercises MongoDB Create Read Update Delete (CRUD) operations with the mongoose npm module\n\n![Alt text](/screenshots/mongo_read.png?raw=true)\n\n## Contains\n- /config = mongo connection config (sample)\n- /controller = controller code with routes and DB operations in personController.js. and DB setup+purge API in setupController\n- model = person DB data model\n- /public = cascading stylesheet \n- /views = EJS views / HTML UI\n- / = app.js main webserver code \u0026 package.json \n\n### Mongo Client UI Functionality:\n- Add a person - CREATE Crud\n- List person(s) - READ cRud\n- Update person (needs MongoID from list function) - UPDATE crUd\n- Delete person (needs MongoID from list function) - DELETE cruD\n\n### Setup API\npurge mongo collection = point browser at http://0.0.0.0:3000/person/purge\nsetup / seed data in collection = http://0.0.0.0:3000/person/setup\n\n\n## Installation overview\n\n### Install mongo DB with auth model\nSee https://docs.mongodb.com/manual/installation/\n\n\n### Clone Repo an install module dependencies\n```\ngit clone https://github.com/ajyounguk/mongodb-crud-demo\ncd mongodb-crud-demo\nnpm install\n```\n\n### Mongo Config\nCopy /config/mongo-config-sample.json to mongo-config.json\nNeeds mongo username and password and mongo running with --auth\n```\ncp config-sample.json config.json\n```\n\n\n## How to run it\n```\nnode app.js\n```\n\npoint your browser at the lport 3000 to load Client\nhttp://0.0.0.0:3000\n\n\n## DB user credentials example\nThis is **NOT** a hardened/strong security model for mongo, but a simple set of reference creds to get you started:\n\n\n1. Start mongo with no auth model:\n```\nmongod\n```\n\n2. \nConnect to mongo cli:\n```\nmongo\n```\n\n3. Create database admin user in mongo cli:\n```\nuse admin\ndb.createUser(\n  {\n    user: \"admin\",\n    pwd: \"mypassword\",\n    roles: [ { role: \"userAdminAnyDatabase\", db: \"admin\" } ]\n  }\n)\n```\n\n4. Restart db with authentication model on:\n```\nmongod -- auth\n```\n\n5. Connect to mongo cli and login with admin user:\n```\nmongo\n\nuse admin\ndb.auth(\"admin\", \"mypassword\" )\n```\n\n6. Create new database (data) and database users \n*PS: if databse does not exist already, it's created*\n\n```\nUse data\ndb.createUser(\n  {\n    user: \"data_dev\",\n    pwd: \"devpassword\",\n    roles: [\n       { role: \"readWrite\", db: \"data\" }\n    ]\n  }\n)\ndb.createUser(\n  {\n    user: \"data_admin\",\n    pwd: \"adminpassword\",\n    roles: [\n       { role: \"dbOwner\", db: \"data\" }\n    ]\n  }\n)\n```\n\n\n7. Create (person) collection in (data) databse\n```\n{\n\tCreate : \"person\"\n}\n```\n\n8. Update the mongo connection configuration file (/config/mongo-config.json). Using the example dev database user above the config file would look like:\n```\n{\n    \"mongourl\": \"mongodb://data_dev:devpassword@127.0.0.1:27017/data\"\n}\n```\n\n\n## More Info\nFor more information on MongoDB:\nhttps://www.mongodb.com/what-is-mongodb\n\nFor more information on Express:\nhttps://www.npmjs.com/package/express\n\nFor more information on Mongoose:\nhttps://www.npmjs.com/package/mongoose\n\n\n\n### EOF Readme.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajyounguk%2Fmongodb-crud-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajyounguk%2Fmongodb-crud-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajyounguk%2Fmongodb-crud-client/lists"}