Select Top 10 a, b from users
equivalent sql query in MONGODB
As a part of jqgrid functionality to save the json data and retrieve json data from the DB, I needed this simple SQL query in MONGODB.
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.
Example:
Documentation:
http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D
As per the comment below, technically, you’d want to sort the collection too, so it would be: