【MongoDB】The high query operation of MongoDB(三)

1, Sort 

Needless to say, mongodb also support to sort data. THe positive one means sorting by asc order and negetive means by desc.

【MongoDB】The high query operation of MongoDB(三)_第1张图片

2. Group

The grammar of group:

【MongoDB】The high query operation of MongoDB(三)_第2张图片

Description Of Argument:

key: The field need to group 

cond: query condition 

Initial: initialize the counter of group

Redue: generally statistic operation

Finalize: further operation after group, for exampe calcuate the average. 

3.【MongoDB】The high query operation of MongoDB(三)_第3张图片

3. Distinct

it's the same as the distinct in the relational database.

【MongoDB】The high query operation of MongoDB(三)_第4张图片


4. page

The mongodb supports to use skip and limit to query by page.

【MongoDB】The high query operation of MongoDB(三)_第5张图片


5. Cursors and Cursor Methods

【MongoDB】The high query operation of MongoDB(三)_第6张图片


6. $query/$orderby/$explain

【MongoDB】The high query operation of MongoDB(三)_第7张图片


你可能感兴趣的:(mongodb)