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…
Show HN: SQL to Mongo Query Translator
11–20 of 34 posts
Re: Show HN: SQL to Mongo Query Translator
#12 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
#13I 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…
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
#14Very 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).
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
#15I 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…
Re: Show HN: SQL to Mongo Query Translator
#16Re: Show HN: SQL to Mongo Query Translator
#17Re: Show HN: SQL to Mongo Query Translator
#18http://rickosborne.org/blog/2010/02/infographic-migrating-fr...
Re: Show HN: SQL to Mongo Query Translator
#19SELECT * FROM demo WHERE score > 0 AND person LIKE '%bob%'
doesn't work that well. It will need to convert the %bob% thing to a regular expression.
Re: Show HN: SQL to Mongo Query Translator
#20Not particularly useful, I tried a simple join and I got this error message: Failure parsing MySQL query: Unable to convert queries based on more than one table