    (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)]

    (to-edge edge-label)
    (to-vertex vertex-label where))))

(defn from-dedup
  ([edge-label vertex-label] (from-dedup edge-label vertex-label {}))
  ([edge-label vertex-label where]
   (concat
    (from-edge edge-label)
    (dedup-on "from")
    (from-vertex vertex-label where))))

(defn to-dedup
  ([edge-label vertex-label] (to-dedup edge-label vertex-label {}))
  ([edge-label vertex-label where]
   (concat
    (to-edge edge-label)
    (dedup-on "to")
    (to-vertex vertex-label where))))

(defn values

  (str "$" (name s)))

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

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

