Skip to content

Query MongoDB with up to 3x less code (uses the Nodejs driver)

License

Notifications You must be signed in to change notification settings

tkaryadis/squery-mongojs

Repository files navigation

Project changed name to squery from cmql, and is moving to squery.org,
until moving completed those still work

Leiningen dependencies

Java or Clojure programmers use squery-mongo-j

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

JS or Clojurescript programmers use squery-mongo-js

[org.cmql/cmql-core "0.2.0-SNAPSHOT"]
[org.cmql/cmql-js "0.2.0-SNAPSHOT"]

SQuery

  • query and data processing language for MongoDB
  • up to 3x less code
  • simple structure
  • simple notation

Usage

  • as tool to generate MQL usable from all drivers
  • to call SQuery code directly from Java/NodeJS/Clojure/Clojurescript

Getting Started

Example

(q (= :bedrooms 1)
   (= :country.code "GR")
   (group {:_id :stars}
          {:average-price (avg :price)})
   (sort :average-price)
   (limit 1))

Generates

aggregate(
[{"$match":
   {"$expr":
     {"$and":
       [{"$eq": ["$bedrooms", 1]},
        {"$eq": ["$country.code", "GR"]}]}}},
 {"$group": {"_id": "$stars",
             "average-price": {"$avg": "$price"}}},
 {"$sort": {"average-price": 1}},
 {"$limit": 1}])

SQuery projects

SQuery example apps

Leiningen dependencies

Java or Clojure programmers use squery-mongo-j

[org.squery/squery-mongo-core "0.2.0-SNAPSHOT"]
[org.squery/squery-mongo-j "0.2.0-SNAPSHOT"]

JS or Clojurescript programmers use squery-mongo-js

[org.squery/squery-mongo-core "0.2.0-SNAPSHOT"]
[org.squery/squery-mongo-js "0.2.0-SNAPSHOT"]

License

Copyright © 2020,2022 Takis Karyadis.
Distributed under the Eclipse Public License version 1.0.

About

Query MongoDB with up to 3x less code (uses the Nodejs driver)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published