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

better implementation of Field count

parent e4cdf1c8
Branches
Tags
No related merge requests found
......@@ -133,10 +133,9 @@
{$project {"_id" false, "avg" true}}))
(defaggregation ["count" field-id]
(aggregate {$match {(field-id->kw field-id) {$exists true}}}
{$group {"_id" nil
"count" {$sum 1}}}
{$project {"_id" false, "count" true}}))
`[{:count (mc/count ^DBApiLayer *mongo-connection* ~*collection-name*
(merge ~*constraints*
{(field-id->kw field-id) {$exists true}}))}])
(defaggregation ["distinct" field-id]
(aggregate {$group {"_id" (field-id->$string field-id)}}
......@@ -144,6 +143,18 @@
"count" {$sum 1}}}
{$project {"_id" false, "count" true}}))
(defn u []
(with-mongo-connection [^DBApiLayer conn (sel :one Database :name "Strider")]
(binding [*collection-name* "venues"]
(eval (aggregate {$match {:atlas_id {$exists true}}}
{$group {"_id" nil
"count" {$sum 1}}}
{$project {"_id" false, "count" true}})))))
(defn x []
(with-mongo-connection [^DBApiLayer conn (sel :one Database :name "Strider")]
))
(defaggregation ["stddev" field-id]
nil) ; TODO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment