Driver methods with cMQL arguments

cMQL can be used in 2 ways

  • cMQL commands, like MQL commands
  • driver methods with cMQL arguments (here we focus on this way)

cMQL arguments

  • pipeline arguments use p
  • filter arguments use f
  • options arguments use o

Pipeline - p

(p stage1 stage2 ...)

Example

(.aggregate zips
(p (= :state "TX")
(group :city {:totalPop (sum :pop))
[:!_id :totalPop]
(sort :!totalPop)))

Takes an cMQL pipeline and produces a java/js pipeline. It can be used in all driver methods call when a pipeline is needed.

Filter - f

(f filter1 filter2)

I write them the way i write them for pipeline,even if no match stage will be used.

Example

(.countDocuments
coll
(f (or (> :age 10) (= :gender "female")))
(o (CountOptions.)
{:limit 10}))

Options - o

For java it is like this

(o optionsClass option1 option2 ...)

For javascript it is like this

(o option1 option2 ...)

Each option should be in the form {:optionName value} or {"optionName" value}

Example in java

(.countDocuments
coll
(f (or (> :age 10) (= :gender "female")))
(o (CountOptions.)
{:limit 10}))