    (fn [out q]
      (let [label (first q)
            query (concat
-                  [{:mark label}]
+                  [[:mark label]]
                   (rest q)
-                  [{:select [label]}])
+                  [[:select [label]]])
            aggregation (translate query)
            un (unwind label)
            group (group-set label)]

  (str "$" (name s)))

(defn dedup
  []
  [{:$group {:_id "$gid" :dedup {:$first "$$ROOT"}}}
   {:$replaceRoot {:newRoot "$dedup"}}])

(defn dedup-on
  [field]
  (let [path (dollar field)]
    [{:$group {:_id path :dedup {:$first "$$ROOT"}}}
     {:$replaceRoot {:newRoot "$dedup"}}]))

    ;; {:$group {:_id dollar (keyword field) {:$first dollar} :_history {:$addToSet "$_history"}}}


   :toVertex to-vertex
   :from from
   :to to
   :fromUnique from-unique
   :toUnique to-unique
   :root root
   :dedup dedup
   :where where
   :match match
   :values values
