In the documentation, the mongodb connection is established once, before being used without passing the connection to each command, is that the proper way to use monger, or should I pass the database connection to each call?
I'm new to Clojure and I'm having issues with Monger.
I'm trying to user Monger with Friend. I have this ns:
(ns cemerick.friend-demo.users
(:require [cemerick.friend.credentials :refer (hash-bcrypt)]))
(def users (atom {"friend" {:username…
My mongodb schema has a JSON hierarchy to it. When I get the field params from compojure, the hash is in flat dotted notation like {"a.b" 1, "a.c" 2, "d.e" 3}. I'm wanting to use monger to insert the data, but that expects a real hierarchical…
I have never used MongoDb before, nor have I used Monger before. I am working on a Clojure app. I simply want to be able to add one document, as an upsert. This is some of my code:
(defn convert-data-to-be-persisted [session-data]
…
Following a previous question where I asked on how on earth do sessions work in Clojure, I have been experimenting with Monger.
In the documentation, you can find the code snippet:
(ns monger.docs.examples
(:require [monger.core :as mg]
…
I have the following code, in which I want to send an InputStream of a file in the function fetch-items, which handles the route /fetch-items.
(defn id->image [image-id]
(let [image (.getInputStream (gfs/find-by-id fs image-id))] image))
(defn…
I'm making the a query using monger like so:
(let [uri mongo-uri
{:keys [conn db]} (mg/connect-via-uri mongo-uri-only)]
(defroutes myRoutes
(GET "/someroute" req
(let [user-id (:id (json/read-str (:body (get-user-info…
I have a mongodb database that I've connected to like so:
(let [uri (config-keys :mongoURI)
{:keys [conn db]} (mg/connect-via-uri uri)])
In Node.js with mongoose, one can do mongoose.Promise = global.Promise, to connect to the database only…
I've a function photos-with-keyword-starting that gets lists of photos for a given keyword from a MongoDB instance using monger, and another that finds subsets of these photos using set/intersection.
(defn photos-with-keywords-starting [stems]
…
When I do a new Date() in an insert in Mongodb shell it gets added as shown below with an ISODate wrapper.
ISODate("2017-12-06T12:56:01.908Z")
But when I format a date as an ISO using joda-time and add it via monger(Clojure Mongo Driver) it gets…
How do I set ReadPreference while using find-maps in Monger ? The Monger documentation only specifies the usage with with-collection of monger.query as shown below
(ns my.service.server
(:refer-clojure :exclude [sort find])
(:require [monger.core…
I am using monger and fetching a batch from my mongo nosql database using find-maps. It returns an array that I plan to use as a datastore argument (reference) downstream in my chain of function calls. Within those future function calls, I will have…
Disclaimer: Clojure noob.
I'm trying to implement a simple get-shows function to return upcoming shows from a MongoDB instance. This returns a LazySeq of length 3, which is what I'd expect:
(defn get-shows []
(let [date-str (f/unparse…
I wish to access a mongo db from clojure using search patterns like this:
find({Keywords: /search-pattern/})
I have a database called "soulflyer", containing an "images" collection and each member has a "Keywords" field containing an array of exif…