{"id":19692336,"url":"https://github.com/root27/go-mongodb","last_synced_at":"2026-05-11T13:36:14.572Z","repository":{"id":175491002,"uuid":"653971011","full_name":"root27/go-mongodb","owner":"root27","description":"Package provides mongo connection","archived":false,"fork":false,"pushed_at":"2024-01-08T09:26:18.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T11:47:14.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/root27.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-15T06:09:47.000Z","updated_at":"2023-06-15T06:21:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"46530328-8022-4a74-b2fb-4471da820c1b","html_url":"https://github.com/root27/go-mongodb","commit_stats":null,"previous_names":["root27/go-mongodb"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/root27/go-mongodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/root27","download_url":"https://codeload.github.com/root27/go-mongodb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-mongodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32897334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-11T19:13:01.932Z","updated_at":"2026-05-11T13:36:14.554Z","avatar_url":"https://github.com/root27.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Go MongoDB\n\n---\n\n### Description\n\nThis is a simple package to connect to a MongoDB database.\n\n### Connection and Get Collection Usage\n\n```go\npackage main\n\nimport (\n    \"github.com/root27/go-mongodb\"\n)\n\nfunc main(){\n     \n\n\tdb ,err:= mongodb.Connect(\"mongourl\") // mongourl is the env variable name\n\n    if err != nil {\n        panic(err)\n    }\n\n    // db is a pointer to a mongo.Database\n    // use it to perform operations on the database\n\n    //Get Collection\n    collection := db.GetCollection(\"databaseName\",\"collectionName\")\n}\n\n```\n\n### Insert Usage\n\n```go\npackage main\n\nimport (\n    \"github.com/root27/go-mongodb\"\n)\n\nfunc main(){\n     \n\n    db ,err:= mongodb.Connect(\"mongourl\") // mongourl is the env variable name\n\n    if err != nil {\n        panic(err)\n    }\n\n    // db is a pointer to a mongo.Database\n    // use it to perform operations on the database\n\n    //Get Collection\n    collection := db.GetCollection(\"databaseName\",\"collectionName\")\n\n    //Insert\n    err = collection.InsertOne(db, bson.M{\"name\": \"pi\", \"value\": 3.14159})\n    if err != nil {\n        panic(err)\n    }\n}\n\n```\n\n### Find Usage\n\n```go\n\npackage main\n\nimport (\n    \"github.com/root27/go-mongodb\"\n)\n\nfunc main(){\n     \n\n    db ,err:= mongodb.Connect(\"mongourl\") // mongourl is the env variable name\n\n    if err != nil {\n        panic(err)\n    }\n\n    // db is a pointer to a mongo.Database\n    // use it to perform operations on the database\n\n    //Get Collection\n    collection := db.GetCollection(\"databaseName\",\"collectionName\")\n\n    //Find\n    var result bson.M\n    err = collection.FindOne(db, bson.M{\"name\": \"pi\"}).Decode(\u0026result)\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(\"pi:\", result[\"value\"])\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot27%2Fgo-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froot27%2Fgo-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot27%2Fgo-mongodb/lists"}