{"id":22071769,"url":"https://github.com/mhutter/mr","last_synced_at":"2026-05-01T01:32:18.142Z","repository":{"id":57606424,"uuid":"138441702","full_name":"mhutter/mr","owner":"mhutter","description":"Go library for interaction with MongoDB","archived":false,"fork":false,"pushed_at":"2018-07-11T14:33:38.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T19:17:54.817Z","etag":null,"topics":["go","golang","mgo","mongodb","odm"],"latest_commit_sha":null,"homepage":"https://gowalker.org/github.com/mhutter/mr","language":"Go","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/mhutter.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-06-24T00:10:10.000Z","updated_at":"2018-07-02T22:41:05.000Z","dependencies_parsed_at":"2022-09-26T20:02:16.175Z","dependency_job_id":null,"html_url":"https://github.com/mhutter/mr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mhutter/mr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fmr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fmr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fmr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fmr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhutter","download_url":"https://codeload.github.com/mhutter/mr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fmr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32482460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"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":["go","golang","mgo","mongodb","odm"],"created_at":"2024-11-30T20:33:59.130Z","updated_at":"2026-05-01T01:32:18.121Z","avatar_url":"https://github.com/mhutter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoRepo\n\n[![GoDoc](https://godoc.org/github.com/mhutter/mr?status.svg)](https://gowalker.org/github.com/mhutter/mr)\n[![Build Status](https://travis-ci.com/mhutter/mr.svg?branch=master)](https://travis-ci.com/mhutter/mr)\n\nLibrary to ease interaction with MongoDB.\n\nThis package is an opinionated abstraction for [mgo][].\n\nTo get started, connect to MongoDB (uses `$MONGODB_URI` from environment if set, or `localhost`):\n\n```go\nrepo := mr.MustAutoconnect(\"db-name\")\n```\n\nInclude the \"Base\" type in your data types:\n\n```go\ntype User struct {\n        mr.Base `json:\",inline\" bson:\",inline\"`\n\n        Name         string `bson:\"name\" json:\"name\"`\n        Email        string `bson:\"email\" json:\"email\"`\n        PasswordHash []byte `bson:\"password_hash\" json:\"-\"`\n}\n```\n\nDoing so will add the following fields to your type:\n\n* ID: ObjectId of the document in the DB\n* CreatedAt: Timestamp of first insertion into DB\n* UpdatedAt: Timestamp of the last update operations\n\nThe \"MongoCollection\" type implements the basic CRUD operations defined in the \"Colleciton\" interface. IDs ,must be passed as strings, and objects are usually types that include the \"Base\" type (see above).\n\n```go\nuser := User{\n        Name: \"John\",\n}\nerr := repo.Insert(\u0026user)\n\nvar users User\nerr := repo.FindAll(\u0026users)\n```\n\n\u003e [Manuel Hutter](https://hutter.io) -\n\u003e GitHub [@mhutter](https://github.com/mhutter) -\n\u003e Twitter [@dratir](https://twitter.com/dratir)\n\n[mgo]: https://github.com/globalsign/mgo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhutter%2Fmr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhutter%2Fmr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhutter%2Fmr/lists"}