Skip to content

Instantly share code, notes, and snippets.

@duanebester
Created November 16, 2021 23:34
Show Gist options
  • Save duanebester/5e3928067b42b285b6ffd93e1207de57 to your computer and use it in GitHub Desktop.
Save duanebester/5e3928067b42b285b6ffd93e1207de57 to your computer and use it in GitHub Desktop.
Web Scraping w/ Clojure add products to Mongo
;; Mongo
(require '[somnium.congomongo :as m])
;; Products database
(def mongo-conn
(m/make-connection
"products"
:instances [{:host "127.0.0.1" :port 27017}]))
;; Set global connection
(m/set-connection! mongo-conn)
;; Add product offers to "bellroy" collection
(m/mass-insert! "bellroy" (:offers product-json))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment