cMQL parts APIs

*cmql-core is written in .cljc files, shared in both cqml-j and cmql-js

Lein dependencies

  • [org.cmql/cmql-core "0.2.0-SNAPSHOT"]
  • [org.cmql/cmql-j "0.2.0-SNAPSHOT"]

Required namespaces

cMQL query functions like q,fq ... creates a local enviroment where all operators/stages are defined.
The bellow big ns definition is so the IDE provides us with auto-complete when we write code.
We dont need to exclude clojure, or :use the cmql.operators etc, we do it for the IDE and auto-complete.
Also we dont need all of them, always, this is made as namespaces overview.

The important ones to see the API are the cmql.operators The important cmql-js ones to see the API are the cmql-j.commands and cmql-j.cmql-arguments cmql-j and cmql-js have similar namespaces structure.

(ns clojureapp.example
(:refer-clojure :only [])
(:use cmql-core.operators.operators ;;aggregate operators
cmql-core.operators.stages ;;aggregate stage operators
cmql-core.operators.options ;;some command options
cmql-j.commands ;; cmql-j commands/methods, using the cmql ones
cmql-j.arguments ;; used to call driver methods, with cmql arguments
cmql-j.driver.cursor ;; some cursor methods, work on driver cursors
cmql-j.driver.document ;; convert maps to Document, to json etc
cmql-j.driver.settings ;; default settings used to connect, clj-registry etc
cmql-j.macros ;; cmql macro,provides an cmql enviroment
)
(:refer-clojure)
(:require [clojure.core :as c]) ;; (q (c/+ 1 2)), because q would hide the core +
(:import (com.mongodb.client MongoClients MongoClient)
(com.mongodb MongoClientSettings)))

cMQL internal namespaces

They are not used from the user directly.

Internal important used from from cMQL-j, cMQL-js

  • cmql-core.read-write
  • cmql-core.administration
  • cmql-core.users
  • cmql-core.roles
  • cmql-core.diagnostic

Internal use from cMQL

  • cmql-core.convert

Cursive

Cursive provides auto-complete, it also allows us to define how a symbol should be resolved. For example if- cMQL operator, we can tell cursive to resolve it as clojure let (helps on spacing) right-click on if-,show-context actions,and resolve as let.