Advanced query language for MongoDB [closed]

Question!

One big advantage of RDBMS is SQL as a very declarative and powerful querying language. I know MongoDB has a query language, but it does not cover joins. Has anyone attempted to make an advanced query language for MongoDB that

a) Handles joining across different collections?

b) Handles joins smartly by looking at indexes in collections and cardinality of the indexes -- i.e. mimic query planning in SQL?

It seems like you should be able to write a higher level query language that uses (b) to smartly output combination of Javascript code and Mongo native queries that perform (a).



Answers

1) MongoDB does have the "query planning". It does it a little differently though. It spins off various options to run the same query in parallel and sees which one completes first, then remembers it and uses it as a compiled plan for a while and then reruns the test again to account for changes in the data, etc.

2) JOIN across collections will make Mongo run the hashing and merges across different nodes which will slow other clients down. it was clearly a conscious decision not to allow queries like this and push it out to the apps. You either architect your docs so that you have all you need in place (thus support for nested documents) or you do your joins in the client

Last but not the least, there was an attempt to build a unified query language across NoSQL databases - UnQL - but with so much difference between column-oriented, document-oriented, key-value, and graph databases there's just so much one can do to generalize the process of querying the data.



This video can help you solving your question :)
By: admin