{"id":42398232,"url":"https://github.com/eshork/go-mongoid","last_synced_at":"2026-01-28T01:11:16.929Z","repository":{"id":40659371,"uuid":"198113140","full_name":"eshork/go-mongoid","owner":"eshork","description":"a (sort of) reimplementation of Mongoid for Go, using mongo-go-driver","archived":false,"fork":false,"pushed_at":"2025-11-02T00:57:34.000Z","size":1582,"stargazers_count":0,"open_issues_count":27,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-02T02:34:09.354Z","etag":null,"topics":["go","golang","mongo","mongodb","mongoid","odm","orm"],"latest_commit_sha":null,"homepage":"","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/eshork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-21T22:58:37.000Z","updated_at":"2022-11-29T23:11:08.000Z","dependencies_parsed_at":"2023-10-03T23:50:44.095Z","dependency_job_id":"c74a5af7-2290-444f-93b4-f6b35deca77f","html_url":"https://github.com/eshork/go-mongoid","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eshork/go-mongoid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshork%2Fgo-mongoid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshork%2Fgo-mongoid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshork%2Fgo-mongoid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshork%2Fgo-mongoid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eshork","download_url":"https://codeload.github.com/eshork/go-mongoid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eshork%2Fgo-mongoid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28831237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T23:29:49.665Z","status":"ssl_error","status_checked_at":"2026-01-27T23:25:58.379Z","response_time":168,"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":["go","golang","mongo","mongodb","mongoid","odm","orm"],"created_at":"2026-01-28T01:11:16.130Z","updated_at":"2026-01-28T01:11:16.906Z","avatar_url":"https://github.com/eshork.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-mongoid\n\n**a work in progress to make go webscale**\n\n\n![alt text](etc/assets/go-mongoid-100.png \"Mongoid for Go\")\n\nThis is a (sort of) reimplementation of [Mongoid](https://github.com/mongodb/mongoid) for Go, using [mongo-go-driver](https://github.com/mongodb/mongo-go-driver) as the connection interface. The primary focus is on ease of use, convenience.\n\n\u003e Mongoid is an ODM (Object-Document Mapper) framework for MongoDB in ~Ruby~ Go\n\nMany things (most things?) don't directly translate from Ruby to Go, but major themes of the Document-related interfaces from the Mongoid API are replicated as closely as possible, with adjustments as needed to facilitate language differences.\n\nAlso, I don't represent or work for MongoDB, Inc.\n\n# Target features for v1.0.0\n\n- Uses Go structs as the primary document interface - ie, build your own custom document definitions using native syntax\n  - Supports all builtin Go data-types as document field-types\n  - Supports custom structs as document field-types (embedded documents)\n  - Supports maps and slices/arrays as dynamic/flexible field-types\n  - Supports custom field data-types (custom structs with their own bson marshaling methods)\n- Default values for new document objects\n- Change tracking - identify which fields have been altered since new object creation or since loading from the database, as well as the previous values\n- Atomic updates - only changed fields are written to the datastore during save operations, same as Ruby Mongoid\n- Query builder interface - concatenating method calls to build complex queries\n\n---\n# Future features\n- Save and recall query Scopes (as well as default scopes per ModelType)\n\n- Model relationships: one-to-one, one-to-many, many-to-many (and the inverses)\n  - Lazy loading for cross-document associations by default\n  - Easy basis to spawn new custom Query builders\n\n- Custom Callbacks based on document lifecycle events (onCreate, onUpdate, onDelete)\n\n- Custom Validations for document lifecycle events (onCreate, onUpdate, onDelete)\n\n- Plugin architecture allows for adhoc add-on functionality (think Mongoid::Paranoia, Mongoid::Versioning, etc)\n\n- MongoDB connection configuration via JSON, YAML, or ENV vars\n\n\n# Installation \u0026 Usage\n\nAdd the library to your project\n\n```bash\ncd ~/yourGoProjectDir\ngo get -u github.com/eshork/go-mongoid\n```\n\nConfigure a MongoDB server\n\n```\nimport mongoid \"https://github.com/eshork/go-mongoid\"\n\ngMongoidConfig := mongoid.Config{\n  Clients: []mongoid.Client{\n    {\n      Name:     \"default\",\n      Hosts:    []string{\"localhost:27017\"},\n      Database: \"yourDbNameHere\",\n    },\n  },\n}\nmongoid.Configure(\u0026gMongoidConfig)\n```\n\nDefine a document model and register it\n\n```\ntype MyDocument struct {\n\tmongoid.Base\n\tMyValue string\n}\n\nvar MyDocuments = mongoid.Register(\u0026MyDocument{})\n```\n\nMake a new item and save it\n\n```go\nnewDoc := MyDocuments.New().(*MyDocument)\nnewDoc.MyValue = \"something noteworthy\"\nnewDoc.Save()\n\nvar mongoid.ObjectID recordId = newDoc.ID\n```\n\nRetrieve stored records by ID\n\n```go\nfoundDoc := MyDocuments.Find(recordId).One().(*MyDocument)\n```\n\nCheck [the wiki](https://github.com/eshork/go-mongoid/wiki) for additional setup information and examples.\n\nRefer to the [examples/](https://github.com/eshork/go-mongoid/tree/master/examples) directory for some use case examples to get you started.\n\nRun `grift docs` to start a local godoc server to view the embedded source documentation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshork%2Fgo-mongoid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feshork%2Fgo-mongoid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshork%2Fgo-mongoid/lists"}