No value supplied for key

64 views
Skip to first unread message

Flavio Oliveira

unread,
May 27, 2014, 9:28:34 AM5/27/14
to clojure...@googlegroups.com
Hi,

I am trying to updated a document and I always get the error below. I can insert without problems.

java.lang.IllegalArgumentException: No value supplied for key: {:multi true}


(defn update-row-teste[]
  (with-connection conn1
    (with-db (get-db conn1 "teste")
      (update "teste" {:id 465} {:handle 3} {:multi true}))))

com.novemberain/monger "1.7.0"

Regards, Flavio

Michael Klishin

unread,
May 27, 2014, 5:32:22 PM5/27/14
to Monger, a Clojure MongoDB driver

2014-05-27 17:28 GMT+04:00 Flavio Oliveira <flav...@gmail.com>:
(defn update-row-teste[]
  (with-connection conn1
    (with-db (get-db conn1 "teste")
      (update "teste" {:id 465} {:handle 3} {:multi true}))))

com.novemberain/monger "1.7.0"

Monger 1.x uses pseudo-keyword args, so it should be

(update "teste" {:id 465} {:handle 3} :multi true)

but an even better idea would be moving to 2.0.

--
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

Flavio Oliveira

unread,
May 28, 2014, 2:56:12 AM5/28/14
to clojure...@googlegroups.com
Michael,

lein run
Retrieving com/novemberain/monger/2.0.0-rc1/monger-2.0.0-rc1.pom from clojars
Retrieving org/mongodb/mongo-java-driver/2.12.1/mongo-java-driver-2.12.1.pom from central
Retrieving org/mongodb/mongo-java-driver/2.12.1/mongo-java-driver-2.12.1.jar from central
Retrieving com/novemberain/monger/2.0.0-rc1/monger-2.0.0-rc1.jar from clojars
Compiling migration.core
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: $set in this context

Trying to do like stated in the docs: (mc/update db coll {:player "sam"} {$set {:score 1088}} {:upsert true}))

Regards/Flavio

Michael Klishin

unread,
May 28, 2014, 3:39:38 AM5/28/14
to Monger, a Clojure MongoDB driver
2014-05-28 10:56 GMT+04:00 Flavio Oliveira <flav...@gmail.com>:
Compiling migration.core
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: $set in this context

migration.core is your own code. You did not refer to monger.operators/$set.
 

Trying to do like stated in the docs: (mc/update db coll {:player "sam"} {$set {:score 1088}} {:upsert true}))

The docs have a section on what Monger version they cover in every guide:

It says 2.0 everywhere.

Flavio Oliveira

unread,
May 28, 2014, 3:54:18 AM5/28/14
to clojure...@googlegroups.com
Michael,

Thank you for replying.


(mc/update db coll {:player "sam"} {$set {:score 1088}} {:upsert true}))
"This guide covers Monger 2.0 (including preview releases)."
Regards, Flavio

Flavio Oliveira

unread,
May 28, 2014, 4:14:41 AM5/28/14
to clojure...@googlegroups.com
Hi,

The solution was include monger.operators:

  (:require [monger.core :as mg]
            [monger.json]
            [monger.joda-time]
            [monger.collection :as mc]
            [monger.operators :refer :all])

Please note that I have upgraded to "2.0.0-rc1"

Thank you, Flavio

On Tuesday, 27 May 2014 15:28:34 UTC+2, Flavio Oliveira wrote:
Reply all
Reply to author
Forward
0 new messages