I’m running into a namespace error. When I attempt to query a collection from the cljblog.db
namespace.
cljblog/db.clj:
(ns cljblog.db
(:require [monger.core :as mg]
[monger.collection :as mc]))
(def db (-> "mongodb://127.0.0.1/cljblog-test"
mg/connect-via-uri
:db))
Steps taken:
-
start repl
lein repl
-
switch namespace
(in-ns 'cljblog.db)
- Query the collection
(mc/find-maps db "articles")
Full error message:
Syntax error compiling at (form-init17588852473615642213.clj:1:1).
No such namespace: mc
My project.clj
(defproject cljblog "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.10.0"]
[compojure "1.6.1"]
[ring/ring-defaults "0.3.2"]
[com.novemberain/monger "3.1.0"]]
:plugins [[lein-ring "0.12.5"]]
:ring {:handler cljblog.handler/app}
:profiles
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.2"]]}})
The repl was restarted after the addition of each dependency.
I get the same error with the latest monger version (3.5.0
)
mongodb is installed and running on the system.