|
|
|
|
|
by pcthrowaway
1896 days ago
|
|
This is phenomenal. The React app alone is truly impressive. You've put a lot of attention into things like displaying the query time and round-trip time. At a glance (and it's a been a while since I've touched MongoDB) the query language looks very similar, maybe compatible with a couple of very minor changes. Was that intentional? |
|
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.