News for hackers. Stuff that matters.
Re:MongoDB Is Abusing JSON by samarudge on Thursday January 17, 2013 @06:53PM (#5076123)
JSON is used as a query language because it's fast, easy to parse and easy to generate dynamically. If you have a query interface for users, SQL is probably a better choice, but Mongo chose JSON for performance reasons.

If you don't like dealing with it directly, use something like MongoEngine so you're not working with the raw queries, or if having readable, easy to understand queries is important, use a SQL database.

Everything is a compromise, with Mongo's query language you're sacrificing readability for performance.

( This is not a comparison of a SQL database to Mongo, just the time it takes for a SQL engine to parse the query into an execution plan )

Re:MongoDB Is Abusing JSON by marshray on Thursday January 17, 2013 @07:02PM (#5076174)
> JSON is used as a query language

Maybe a little more accurate to say JSON is used as a base layer for the query language.

JSON is "JavaScript Object Notation". But the "meaning" of the query is in the objects being denoted, not the notation used to represent them as text. So comparing Mongo's use of JSON to SQL is apples-to-oranges.

We could encode SQL as JSON too:

    {"query": "SELECT * FROM things;"}
or

    {"query": [
        {"SELECT": "*"},
        {"FROM": "things"} ] }
without affecting the expressive power of the SQL language one bit.
Re:MongoDB Is Abusing JSON by sm_sohan on Thursday January 17, 2013 @08:01PM (#5076393)
This doesn't have to be this way. The underlying machine friendly API can be hidden under a human friendly API abstraction.