I'm using mongodb in a multithreaded clojure app, using the monger library, and one of my producer threads are dying with
java.lang.IllegalStateException: state should be: open
at com.mongodb.assertions.Assertions.isTrue (Assertions.java:70)
…
I am accessing Mongo database from Clojure using Monger library. One thing that annoys me is switching back and forth between ObjectId instances and strings.
For example, the this code (mc/find-maps "posts" {}) will evaluate to maps with the value…
I am new to clojure.
Are there any idioms/patterns around connecting to mongodb through monger?
Do I have to connect and disconnect using
(monger.core/connect) & (monger.core/disconnect conn)
respectively. each time ?
Is there a way I can reuse a…
In Monger there is a insert-and-return function for returning a newly inserted document.
There is no update-and-return function.
How can I return an updated document from the function that executes the update?
I think I could use save-and-return but…
I guess this question qualifies as an entry-level clojure problem. I basically have troubles processing a clojure map multiple times and extract different kinds of data.
Given a map like this, I'm trying to count entries based on multiple nested…
I am using monger to connect with the database, but I'm getting that the connection string is invalid:
Caused by: java.lang.IllegalArgumentException: The connection string is invalid. Connection strings must start with 'mongodb://'
Here's my code…
I'm attempting to test some database operations in a luminus app with the Monger database library.
Ideally, I'd like the following to work. I've stripped out some of the irrelevant code.
Test File:
(ns app.test.handler
(:require [clojure.test…
Trying to Insert a Document to Mongo using Monger With a Float/Big Decimal in it
(mc/insert db "products" {:name "Shirt" :Price 300.00M })
and gets the following Error .
ERROR compojure.api.exception - Can't find a codec for class…
I'm using Monger to store data in MongoDB. I would like to store a Clojure set. Reading and writing the set does work, but it is returned as a list. I suspect MongoDB doesn't actually support the set data type, so the Monger client doesn't either,…
I'm probably missing something simple, but I'm not experienced enough with clojure to understand the error I'm getting.
I have a simple luminus clojure app setup with the Monger library to handle my MongoDB connection. I've added a simple test that…
I have a data set on mongo like:
{"month": 9, "year": 2015, "name": "Mr A"}
{"month": 9, "year": 2015, "name": "Mr B"}
{"month": 10, "year": 2015, "name": "Mr B"}
{"month": 11, "year": 2016, "name": "Mr B"}
I am trying to get the minimum date from…
I'm trying to run a small Clojure web app I wrote, and I'm getting an exception from lein ring server that isn't giving me any useful information. I've googled the error and found this discussion, which suggested running lein deps :tree to route out…
I’m using a MongoDB database to keep track of analytics for an application. I’m writing a Clojure application (using clj-time and Monger) to get data out of the database.
I have a collection containing records like
{"_id": ObjectId(...),
timestamp:…
I have a replica set and I want to establish standalone read-only connection to a slave instance.
Normally, I should experience no problems doing it. The only thing I ought to do is to set slaveOk=true to be able to query it with read operations. It…
I'm using Clojure's Monger library to connect to a MongeoDB database.
I want to update, insert & remove subdocuments in my Mongo database. MongoDB's $push modifier lets me do this on the root of the searched document. But I want to be able to $push…