{"id":13804984,"url":"https://github.com/vlang/mongo","last_synced_at":"2025-03-05T20:36:11.355Z","repository":{"id":47751884,"uuid":"315322795","full_name":"vlang/mongo","owner":"vlang","description":"Official MongoDB driver","archived":false,"fork":false,"pushed_at":"2024-09-06T11:32:21.000Z","size":687,"stargazers_count":47,"open_issues_count":5,"forks_count":8,"subscribers_count":29,"default_branch":"main","last_synced_at":"2025-01-16T07:26:48.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"V","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/vlang.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":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-23T13:23:41.000Z","updated_at":"2024-12-13T00:41:11.000Z","dependencies_parsed_at":"2024-01-01T01:27:02.924Z","dependency_job_id":"92a6b29c-847d-49c1-b690-dcec96e6a860","html_url":"https://github.com/vlang/mongo","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/vlang%2Fmongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fmongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fmongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fmongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vlang","download_url":"https://codeload.github.com/vlang/mongo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242099701,"owners_count":20071584,"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":[],"created_at":"2024-08-04T01:00:55.975Z","updated_at":"2025-03-05T20:36:11.326Z","avatar_url":"https://github.com/vlang.png","language":"V","funding_links":[],"categories":["Libraries"],"sub_categories":["Database clients"],"readme":"## Mongo\n\n_MongoDB driver for vlang_\n\n### Getting start:\n\n#### Installing dependeces\n\n[libmongoc](http://mongoc.org/libmongoc/current/installing.html#install-libmongoc-with-a-package-manager)(MongoDB C Driver)\n[libbson](http://mongoc.org/libmongoc/current/installing.html#install-libbson-with-a-package-manager)(BSON library)\n\n```bash\n# Debian and Ubuntu\nsudo apt-get install libmongoc-dev\nsudo apt-get install libbson-1.0-0\n```\n\n```bash\n# Fedora\ndnf install mongo-c-driver\ndnf install libbson\n```\n\n```bash\n# CentOS and RHEL 7\nyum install mongo-c-driver\nyum install libbson\n```\n\n```bash\n# macOS\nbrew install mongo-c-driver\n```\n\n#### Starting MongoDB\n\n```bash\nmongo --host localhost --port 27017\n```\n\n#### Installing mongo package from `vpm`\n\n```bash\nv install mongo\n```\n\n**Examples**\n\n\n```v\n// connect to mongo\nmongo_uri := mongo.uri_new('mongodb://127.0.0.1:27017')\nclient := mongo_uri.new_client()\n\n// select database\ndatabase := client.get_database('db_name')\n\n// select collection\ncollection := client.get_collection('db_name', 'collection_name')\n\n// insert collection\ncollection.insert_one({\n  'str':     'string'\n  'number':  2\n  'float':   2.1\n  'boolean': true\n})\n\n// find collection\nresponse := collection.find({\n  'str': 'string'\n}).lean()\n\nassert response[0].as_map()['str'] or { 0 }.str() == 'string'\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlang%2Fmongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvlang%2Fmongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlang%2Fmongo/lists"}