{"id":26022956,"url":"https://github.com/agrison/duct-mongodb","last_synced_at":"2025-10-31T08:45:43.040Z","repository":{"id":62433591,"uuid":"137937427","full_name":"agrison/duct-mongodb","owner":"agrison","description":"Integrant methods for connecting to a MongoDB database via Monger","archived":false,"fork":false,"pushed_at":"2020-10-19T19:18:01.000Z","size":12,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T18:23:35.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agrison.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-19T19:40:23.000Z","updated_at":"2020-10-31T19:49:42.000Z","dependencies_parsed_at":"2022-11-01T21:02:01.515Z","dependency_job_id":null,"html_url":"https://github.com/agrison/duct-mongodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agrison/duct-mongodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrison%2Fduct-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrison%2Fduct-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrison%2Fduct-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrison%2Fduct-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agrison","download_url":"https://codeload.github.com/agrison/duct-mongodb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrison%2Fduct-mongodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281960270,"owners_count":26590411,"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-10-31T02:00:07.401Z","response_time":57,"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":"2025-03-06T10:37:35.610Z","updated_at":"2025-10-31T08:45:43.001Z","avatar_url":"https://github.com/agrison.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Duct database.mongodb.monger\n\n[![Build Status](https://travis-ci.org/agrison/duct-mongodb.svg?branch=master)](https://travis-ci.org/agrison/duct-mongodb)\n\n[Integrant][] methods for connecting to a [MongoDB][] database via\n[Monger][].\n\n[integrant]: https://github.com/weavejester/integrant\n[mongodb]: https://www.mongodb.com\n[monger]: http://clojuremongodb.info\n\n## Installation\n\nTo install, add the following to your project `:dependencies`\n\n    [me.grison/duct-mongodb \"0.1.1\"]\n\n## Usage\n\nThis library provides two things: \n* a `Boundary` record that holds both the Monger connection (`:conn`)\nand the selected database (`:db`).\n* a multimethod for `:duct.database.mongodb/monger` \nthat initiates the connection based\non those options into the\n`Boundary`.\n\n\nWhen you write functions against the MongoDB database, consider using a\nprotocol and extending the `Boundary` record. This will allow you to\neasily mock or stub out the database using a tool like [Shrubbery][].\n\n[shrubbery]: https://github.com/bguthrie/shrubbery\n\n\n## Connection settings\n\n### URI\n\n```edn\n{:duct.database.mongodb/monger \n  {:uri \"mongodb://127.0.0.1:27017/hello?username=foo\u0026password=bar\"}\n```\n\nAdditional parameters can be used in the [URI format][].\n\n[uri format]: https://docs.mongodb.com/manual/reference/connection-string/\n\n### Host \u0026 port\n\n```edn\n{:duct.database.mongodb/monger \n  {:host \"127.0.0.1\", :port 27017, :db-name \"hello\"}}\n```\n\n### Host \u0026 port with extended options\n\n```edn\n{:duct.database.mongodb/monger \n  {:host \"127.0.0.1\", :port 27017, :db-name \"hello\"\n   :options {:socket-timeout 1234\n             :threads-allowed-to-block-for-connection-multiplier 300}}}\n```\n\nSee [MongoOptions][] for more information.\n\n[mongooptions]: http://api.mongodb.com/java/current/com/mongodb/MongoOptions.html\n\n## Example\n\nConsider a MongoDB database where a `users` collection exist, \ncontaining documents having at least a `username` field.\n\nThe database connection can be extracted from this module\n`Boundary` by using the `:db` key.\n\nIf you need access to the whole connection you can do so using\nthe `:conn` key.\n\n```clojure\n(ns my-project.boundary.user-db\n  (:require [duct.database.mongodb.monger]\n            [monger.collection :as mc]))\n            \n(defprotocol UserDatabase\n  (get-user [db username]))\n  \n(extend-protocol UserDatabase\n  duct.database.mongodb.monger.Boundary\n  (get-user [{:keys [db]} username]\n    (mc/find db \"users\" {:username username})))\n```\n\nFor more information using Monger, you can start with their\n[getting started](http://clojuremongodb.info/articles/getting_started.html)\nwebpage.\n\n## Building \u0026 testing this library\n\nIf you already have a mongodb running on your machine just type\n`lein test`\n\nIf you don't have mongodb installed on your machine you can type\n`lein embongo test` which will download an embedded mongodb and run\nit during the test phase.\n\n## License\n\nCopyright © 2018 Alexandre Grison\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrison%2Fduct-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagrison%2Fduct-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrison%2Fduct-mongodb/lists"}