apa512 / clj-rethinkdb

Eclipse Public License 1.0
205 stars 42 forks source link

Arrays in optargs #196

Open jwr opened 6 years ago

jwr commented 6 years ago

I am trying to run reconfigure, but it seems that I can't pass an array in optargs. The following code:

(defn setup-replication! []
  (q (r/reconfigure {:shards 1
                     :replicas {"primary" 1
                                "secondary" 2}
                     :primary-replica-tag "primary"
                     :nonvoting-replica-tags ["secondary"]})))

fails with:

1. Unhandled clojure.lang.ExceptionInfo
   RethinkDB server: Expected a TermType as a NUMBER but found STRING.
   {:type :compile,
    :response
    {:t 17,
     :r ["Expected a TermType as a NUMBER but found STRING."],
     :b ["nonvoting_replica_tags"]}}

removing the brackets around "secondary" results in:

1. Unhandled clojure.lang.ExceptionInfo
   RethinkDB server: Expected type ARRAY but found STRING: "secondary"
   {:type :query-logic,
    :response
    {:t 18,
     :e 3000000,
     :r ["Expected type ARRAY but found STRING:\n\"secondary\""],
     :b ["nonvoting_replica_tags"]}}

It seems like the Clojure vector is not being converted into a RethinkDB ARRAY.