Why cMQL for ClojureScript

  • its like querying MongoDB with ClojureScript (names and syntax)
  • up to 3x less code from MQL
  • can unify MongoDB under 1 language
    • app in clojureScript
    • query with cMQL
    • server side with Clojurescript or cMQL wrappers or Wisp
  • Fast, data encode/decode directly to ClojureScript maps vectors

For more details see what? and why? ClojureScript programmers use cMQL-js

Install cMQL

Use the dependencies from clojars

  • [org.cmql/cmql-core "0.1.0-SNAPSHOT"]
  • [org.cmql/cmql-js "0.1.0-SNAPSHOT"]

Or lein install using the source code on github.



For more cMQL example see cMQL-Play and the code of Clojureapp cMQL-js queries the same with cMQL-j queries, only differences is the async calls of nodejs.

Init the app

ClojureScriptapp uses shadow-clj as its build tool There is a script file called init-shadow that does

  • npm install
  • copy the custom js files to support clojure<->bson direct encode/decode
  • starts the shadow-cljs server for fast compile
  • creates a pom file, to allow us to open the project with as maven project and find the code for auto-complete etc

Open the code

If you use intellijdea

  • open intellij idea
  • open project from existing resources
  • select the clojureappScript app
  • select maven

See and run the examples,run the namespaces independently

Run the code

The code runs with a script called run-shadow Clojurescript-app it uses :use in ns for ide auto complete, that clojurescript doesn't support so the first thing is to remove this.

  • runs the usecljs-0.1.0-SNAPSHOT-standalone.jar to make comment the use
  • compiles the project with shadow-cljs
  • runs the usecljs-0.1.0-SNAPSHOT-standalone.jar to uncoment the use
  • run the compiled main.js with node

This script can be run from terminal, or with intelijea run configurations and add shell-script (without execute in terminal option), to run from the Run button.