Please help me find the MongoDb equivalent for the SQL:
select val from tblName where colName1 = 7
group by colName2
order by colName3 desc, colName4 desc
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For everything except the grouping :
But for grouping, you are either looking at MapReduce or the new Aggregation Framework (the Aggregation Framework isn’t in a stable build yet, it is only in 2.1.0 and odd-numbered releases aren’t production ready)
With the Aggregation Framework, based upon a quick scan of the documentation and no access to the latest Mongo (ie copy & pasting won’t work – it’s a basis on which to start):
If anyone wants to improve on the syntax (ie someone with access to a Mongo with Aggregation) feel free 🙂