Hacker News new | ask | show | jobs
by adamlouis 1900 days ago
Thank you! Appreciate it! Glad you noticed some of the details.

I didn't intentionally model the Mongo query language. Some requirements were:

- JSON-based: so I did not have to parse the query

- Easy to extend: so I could add new operators later

- DB independent: so I could swap out SQLite with postgres, mongo, cockroach, duckdb, etc. IF I ever wanted to

- Expressive: so I could do aggregations / group-bys / etc

I considered using more popular standards like the ElasticSearch API but they weren't quite what I wanted. I liked how jsonlogic was basically just an AST. Its primitive structure makes code generation to other DB query languages straightforward.

I started this project with my own "JSON lisp" variant, but then found jsonlogic & used that since mine was _pretty_ close (only lists, no objects).

The top-level fields of my queries look like SQL (select, where, group_by, order_by) - I really like the Honeycomb query UI (https://www.honeycomb.io/query/) - so wanted to be able to support user experiences like that ... but also go further via arbitrary jsonlogic expressions.