{"id":20872381,"url":"https://github.com/romnn/mongotypes","last_synced_at":"2026-05-18T02:11:07.117Z","repository":{"id":57534976,"uuid":"283308660","full_name":"romnn/mongotypes","owner":"romnn","description":"additional types for the golang mongo-driver.","archived":false,"fork":false,"pushed_at":"2021-02-03T21:34:56.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T16:02:48.333Z","etag":null,"topics":["decoding","golang","mongo-driver","mongodb","replicaset","types"],"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/romnn.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":"2020-07-28T19:30:45.000Z","updated_at":"2021-02-03T21:34:59.000Z","dependencies_parsed_at":"2022-09-26T18:21:46.843Z","dependency_job_id":null,"html_url":"https://github.com/romnn/mongotypes","commit_stats":null,"previous_names":["romnnn/mongotypes"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/romnn/mongotypes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romnn%2Fmongotypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romnn%2Fmongotypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romnn%2Fmongotypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romnn%2Fmongotypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romnn","download_url":"https://codeload.github.com/romnn/mongotypes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romnn%2Fmongotypes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274113111,"owners_count":25224346,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"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":["decoding","golang","mongo-driver","mongodb","replicaset","types"],"created_at":"2024-11-18T06:18:56.652Z","updated_at":"2026-05-18T02:11:02.072Z","avatar_url":"https://github.com/romnn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## mongotypes\n\n[![Build Status](https://github.com/romnn/mongotypes/workflows/test/badge.svg)](https://github.com/romnn/mongotypes/actions)\n[![GitHub](https://img.shields.io/github/license/romnn/mongotypes)](https://github.com/romnn/mongotypes)\n[![GoDoc](https://godoc.org/github.com/romnn/mongotypes?status.svg)](https://godoc.org/github.com/romnn/mongotypes)  [![Test Coverage](https://codecov.io/gh/romnn/mongotypes/branch/master/graph/badge.svg)](https://codecov.io/gh/romnn/mongotypes)\n[![Release](https://img.shields.io/github/release/romnn/mongotypes)](https://github.com/romnn/mongotypes/releases/latest)\n\nProvides types for [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) that can be used to construct and decode mongodb responses.\n\n**Note**: Currently, only types needed for configuration of mongodb replicasets are provided.\n\n**Note**: If you are looking for types for [gopkg.in/mgo.v2](https://github.com/go-mgo/mgo), have a look at [juju/replicaset](https://github.com/juju/replicaset).\n\n#### Example\n\nLets say you want to run the `replSetGetStatus` command to check the primary of your replicaset. You can use `replicaset.Status` with `Decode` to parse the raw bson result.\n\n```golang\nimport \"github.com/romnn/mongotypes/replicaset\"\n\nvar statusResult replicaset.Status\n\n// adminDatabase is a connected mongo db admin database\nif err := adminDatabase.RunCommand(context.TODO(), bson.D{{\"replSetGetStatus\", nil}}).Decode(\u0026statusResult); err != nil {\n    log.Fatal(err)\n}\nprimary := statusResult.Primary()\nif primary == nil {\n    log.Fatal(\"The replicaset has no primary\")\n}\n```\n\nFor more examples, see `examples/`.\n\n\n#### Development\n\n######  Prerequisites\n\nBefore you get started, make sure you have installed the following tools::\n\n    $ python3 -m pip install -U cookiecutter\u003e=1.4.0\n    $ python3 -m pip install pre-commit bump2version invoke ruamel.yaml halo\n    $ go get -u golang.org/x/tools/cmd/goimports\n    $ go get -u golang.org/x/lint/golint\n    $ go get -u github.com/fzipp/gocyclo\n    $ go get -u github.com/mitchellh/gox  # if you want to test building on different architectures\n\n**Remember**: To be able to excecute the tools downloaded with `go get`, \nmake sure to include `$GOPATH/bin` in your `$PATH`.\nIf `echo $GOPATH` does not give you a path make sure to run\n(`export GOPATH=\"$HOME/go\"` to set it). In order for your changes to persist, \ndo not forget to add these to your shells `.bashrc`.\n\nWith the tools in place, it is strongly advised to install the git commit hooks to make sure checks are passing in CI:\n```bash\ninvoke install-hooks\n```\n\nYou can check if all checks pass at any time:\n```bash\ninvoke pre-commit\n```\n\nNote for Maintainers: After merging changes, tag your commits with a new version and push to GitHub to create a release:\n```bash\nbump2version (major | minor | patch)\ngit push --follow-tags\n```\n\n#### Note\n\nThis project is still in the alpha stage and should not be considered production ready.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromnn%2Fmongotypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromnn%2Fmongotypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromnn%2Fmongotypes/lists"}