Skip to content
Snippets Groups Projects
Commit 9f5a86b3 authored by Cam Saul's avatar Cam Saul
Browse files

fix nasty nasty nasty logic error

parent 8e6697e0
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,7 @@
{(name column-name)
(field->base-type {:name (name column-name)
:table (delay table)
:qualified-name-components (delay [(name column-name)])})}))))
:qualified-name-components (delay [(:name table) (name column-name)])})}))))
(table-pks [_ _]
#{"_id"})
......@@ -106,6 +106,7 @@
"You must have an open Mongo connection in order to get lazy results with field-values-lazy-seq.")
(let [table @table
name-components (rest @qualified-name-components)]
(assert (seq name-components))
(map #(get-in % (map keyword name-components))
(mq/with-collection *mongo-connection* (:name table)
(mq/fields [(apply str (interpose "." name-components))]))))))
......
......@@ -82,7 +82,6 @@
This just gets counts the types of *every* value and returns the `base_type` for class whose count was highest."
[values-seq]
{:pre [(sequential? values-seq)]}
(println (first values-seq))
(or (->> values-seq
;; TODO - why not do a query to return non-nil values of this column instead
(filter identity)
......@@ -91,14 +90,12 @@
;; nil)
(take 1000)
(group-by type)
;; create tuples like [Integer -count]. Make count negative so when we call (sort-by second) in the next step the rows
;; with the highest count will be returned first (e.g. [Integer -100] will be sorted ahead of [Float -20])
(map (fn [[klass valus]]
(println [klass (count valus)])
[klass (count valus)]))
[klass (- 0 (count valus))]))
(sort-by second)
first
first
((fn [klass]
(println klass)
klass))
driver/class->base-type)
:UnknownField))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment