MONGDB Basic Learning (v)--projection, pagination, sorting, aggregationThe learning of Basic grammarThe new Year is coming soon, tomorrow is a lover, the day after tomorrow will be a holiday, hope that they can in the holiday before the five and six
Today to share with you the more interesting knowledge of MongoDB, mainly include: aggregation, cursors.
One: Aggregation
Common aggregation operations are the same as SQL Server: Count,distinct,group,mapreduce.
Count
Count is the simplest,
MongoDB paging query method and Performance
I have been a little busy recently. There are a lot of things to summarize. In fact, there should be four, five, and six Redis series... however, Redis in Action has not been completed yet. I will
Aggregate equivalent to the group in MySQL and a series of operationsOfficial website address: http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/
An expression
Describe
Instance
$sum
First, the preparatory work1. Download MongoDB: Http://www.mongodb.org/downloadsChoose the right version for youRelated documents: Http://www.mongodb.org/display/DOCS/Tutorial2. Installing MongoDBA, no pressure mode:Open the downloaded
Recently a little busy, there were a lot of things to summarize, the Redis series in fact, there should be four, five or six ... However, "Redis in action" has not finished reading, and so after reading to summarize, otherwise too water, sorry
Traditional SQL pagingIn traditional SQL paging, almost no row_number exists in all solutions. For scenarios that require various sorting and complex queries, row_number is a killer. In addition, the time stamp is usually used for paging loading by
Use skip and limit to do data paging as follows:
Code:
Page1 = Db.things.find (). Limit ()
Page2 = Db.things.find (). Skip (limit) page3
= Db.things.find (). Skip (limit). (20)
Note: Can be used for paging, limit is Pagesize,skip
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.