MongoDB Is Abusing JSON
smsohan.com
MongoDB Is Abusing JSON
1–10 of 61 posts
Re: MongoDB Is Abusing JSON
#2Re: MongoDB Is Abusing JSON
#3Re: MongoDB Is Abusing JSON
#4Plus, the API isn't really abusing JSON. It isn't pretty, but it's not abuse.
Re: MongoDB Is Abusing JSON
#5If 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
#6There is always http://querymongo.com/ which will convert SQL to a MongoDB query.
Re: MongoDB Is Abusing JSON
#7TL;DR: JSON sucks for representing queries.
Re: MongoDB Is Abusing JSON
#8 r.table('orders')
.pluck('cust_id','ord_date','price')
.groupBy('cust_id','ord_date', r.sum('price')).
.filter(r.row('reduction').gt(250))
We use the hard-coded attribute 'reduction' because groupBy automatically gets compiled to our distributed map-reduce infrastructure. There is currently no as command (though it could easily be simulated with map). I'll add a GitHub issue for this shortly, since we should add sugar for it.Re: MongoDB Is Abusing JSON
#9MongoDB's limit(x) and skip(y) are a shitload nicer than most of Microsoft's ideas about pagination. It was only in SQL Server 2012 that they came up with "OFFSET" instead of "google it".... http://stackoverflow.com/questions/2244322/how-to-do-paginat...
Re: MongoDB Is Abusing JSON
#10For me the Mongo shell is just enough so-called "richness" and "expressiveness" (Try it yourself: http://try.mongodb.org/). There's a certain magic to passing objects to functions (and being able to, say, read the body of a function by typing that object into the CLI).