Live data from Hacker News

Show HN: SQL to Mongo Query Translator

querymongo.com

11–20 of 34 posts

Re: Show HN: SQL to Mongo Query Translator

#11

I don't have any experience with MongoDB, but the example put me off using it completely. The MySQL query is concise and brief, the MongoDB equivalent is bloated. Only after several seconds I was able to deduce that the MongoDB query probably does something more than MySQL query. Can you please make the examples more comparable? Or did I misunderstand the MongonDB and it actually is so bloated by design? I believe it…

This, exactly. Great tool, but having no experience with Mongo yet, I literally said aloud "So verbose...!" when I saw the translation.

Re: Show HN: SQL to Mongo Query Translator

#12
The example would be much clearer as an aggregation query. Roughly:

    db.demo.aggregate([
        { $match: { score: { $gt: 0 },
                    person: { $in: ["bob","jake"] }}},
        { $group: { _id: "person",
                    sumscore: { $sum: "$score" },
                    avgscore: { $avg: "$score" },
                    minscore: { $min: "$score" },
                    maxscore: { $max: "$score" },
                    count: { $sum: 1 }}}
    ]);

Re: Show HN: SQL to Mongo Query Translator

#13

I don't have any experience with MongoDB, but the example put me off using it completely. The MySQL query is concise and brief, the MongoDB equivalent is bloated. Only after several seconds I was able to deduce that the MongoDB query probably does something more than MySQL query. Can you please make the examples more comparable? Or did I misunderstand the MongonDB and it actually is so bloated by design? I believe it…

>> Or did I misunderstand the MongonDB and it actually is so bloated by design?

Depending on the type of query and the way you designed your database schema MongoDB queries can be either more concise or (in your words) more bloated than SQL. You can't really say either one is more bloated than the other in terms of query syntax.

Personally, I generally prefer MongoDB queries over SQL, because it doesn't have a concept of joins, inner queries, temporary tables, etc, which usually translates to more but simpler queries. If the data model for your applications relies heavily on any of these features, maybe you shouldn't use MongoDB (or any other NoSQL database, for that matter).

Re: Show HN: SQL to Mongo Query Translator

#14
post #8

Very nice! I once thought about doing something like this, but I had some real work to do. Thanks for this resource! This is specially useful because of the verbosity and ugliness of the "JSON" API (much more difficult to get right by hand than SQL) and because I found 0 working GUI tools to work with Mongo in a mac (they all crash at startup or after ~5 seconds of usage in a modern mac).

MongoHub (http://mongohub.todayclose.com/) works for me.

It's not very polished, but it gets the job done, and it makes it relatively easy to edit stuff that's already in the database.

Re: Show HN: SQL to Mongo Query Translator

#15

I don't have any experience with MongoDB, but the example put me off using it completely. The MySQL query is concise and brief, the MongoDB equivalent is bloated. Only after several seconds I was able to deduce that the MongoDB query probably does something more than MySQL query. Can you please make the examples more comparable? Or did I misunderstand the MongonDB and it actually is so bloated by design? I believe it…

MongoDB's query language is just not very good.
Post reply on HN