This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (5)
- # babashka (81)
- # beginners (26)
- # calva (6)
- # cider (7)
- # clojure (26)
- # clojure-czech (1)
- # clojure-europe (19)
- # clojure-nl (4)
- # clojure-spec (5)
- # clojure-uk (21)
- # clojuredesign-podcast (2)
- # clojurescript (19)
- # conjure (6)
- # cursive (13)
- # datomic (2)
- # depstar (1)
- # editors (2)
- # graalvm (25)
- # honeysql (5)
- # jackdaw (4)
- # jobs (5)
- # lsp (8)
- # malli (13)
- # music (1)
- # polylith (3)
- # practicalli (1)
- # releases (1)
- # remote-jobs (2)
- # sci (10)
- # shadow-cljs (5)
- # sql (14)
- # tools-deps (25)
- # xtdb (65)
Hi I’m working with monger the mongoDB Clojure wrapper, I’m trying to create a user on the database, the function seems simple enough
but when I do something like this
add-user (add-user db username password) Adds a new user for this db
It gives this error.
(db/add-user db "test" "12345")
What does this error mean? If its any help, this is what the function looks like in the monger source code
java.lang.String cannot be cast to [C
Thanks in advance
(defn add-user "Adds a new user for this db" [^DB db ^String username ^chars password] (.addUser db username password))
^chars are used for arrays of characters (which is different from String).
(db/add-user db "test" (.toCharArray "12345")) work?
Oh that works! If you don’t mind me asking, whats the difference between
(char "12345") and
char will try to cast its argument to a single character (type is
(.toCharArray "asf") will return an array of chars (type is similar to
char) for a given string
can i define
clojure.test tests in a loop?
(defn generate-tests  (deftest "major test" (for [case [1 2 3]] (testing (str "is " case " = 1") (is (= 1 case))))))
I do it like this:
note that the second arg to
(defn exercise-case [x] (is (= 1 x) (str "is" x "= 1"))) (deftest exercise-1 (exercise-case 1)) (deftest exercise-2 (exercise-case 2)) (deftest exercise-3 (exercise-case 3))
isis printed on test failure, just like
testingbut it can be calculated on demand in its scope
Is it best practice under Linux to install leiningen from the distro's package manager, or should I install something under my user?
The package manage will be slightly simpler and familiar process and should ensure the binaries do not conflict with anything else on the execution path.
If you wish to have a specific version, then install in
_/.local/bin which is on most exec paths by default if that directory exists.
If configuring a multi-user system and then install in
/user/local/bin using sudo instead.
i'd recommend not using the distro's version. Those come with upgrades prevented. If you install it yourself you can easily run
lein upgrade <version> and easily change the version if there are bugs, incompatibilities, etc