Mongodb advanced 2: mongodb aggregation and mongodb advanced AggregationIn the previous article we talked about mongodb's advanced query: http://blog.csdn.net/stronglyh/article/details/46817789
This article introduces mongodb aggregation.
I. mongodb
Heard that the project inside aggregation use more, then specifically for this a lot of practice.
The basic operations include:
• $project-You can extract fields from subdocuments, and you can rename fields
• $match-the ability to find
•
In the previous article we talked about MongoDB advanced query: http://blog.csdn.net/stronglyh/article/details/46817789This article is about MongoDB aggregation.A: MongoDB has a lot of aggregation framework, so that the transformation and
/*** MongoDB $type operator*/
/*** The $type operator is based on the Bson type to retrieve the matching data type in the collection and returns the result.* The types of MongoDB that can be used are shown in the following table:* Type Number Notes*
MongoDB database data aggregation & amp; Pipe operations, mongodb database AggregationThe data aggregation process for pipeline operations on mongodb usually works with pipeline operations. The pipeline operation concept of mongodb is similar to the
Some basics forget to check at any time.#整备恢复Mongodump--port 20001--authenticationdatabase=admin-u *-D lvlv-c lvlv-o/homeMongorestore--drop--host 172.16.201.74--port 20001--authenticationdatabase=admin-umgbackup-d test/tmp/liding/test
Start the corresponding SERVER:CD: Mongod--dbpath db Path to the Mangodb installation root directoryTo create the MANGODB service:Mongod.exe--logpath d:/mongodb/logs/mongodb.log--logappend--dbpath d:/mongodb/db--directoryperdb--serviceName
AggregationAggregate
Aggregation (aggregate) is primarily used to calculate data, similar to sum (), AVG () in SQL
Grammar
Db. Collection name. Aggregate ([{pipe: {expression}}])Piping
Pipelines are typically used in UNIX
Recently has been using MongoDB, sometimes will need to use statistics, on the Internet to check some information, the most suitable for use is to use aggregate, the following introduction of their own use of experience.
MongoDB
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.