Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tryber/mongodb-aggregation-cheats…
Browse files Browse the repository at this point in the history
…heet
  • Loading branch information
cleytonoliveira committed Mar 9, 2021
2 parents f688d61 + d127943 commit 846849d
Showing 1 changed file with 44 additions and 6 deletions.
50 changes: 44 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

# Sumário

- [MongoDB Aggregation Cheat Sheet](#mongodb-aggregation-cheat-sheet)
- [Sumário](#sumário)
- [Operadores](#operadores)
- [Operadores Aggregation](#operadores-aggregation)
- [$match](#match)
- [$limit](#limit)
- [$group](#group)
- [$project](#project)
- [$unwind](#unwind)
- [$lookup](#lookup)
- [$lookup (let/pipeline)](#lookup-letpipeline)
- [$addFields](#addfields)
- [Operadores Aritméticos](#operadores-aritméticos)
Expand All @@ -25,7 +33,7 @@

**Template**

```javascript
```
db.collection.aggregate([
{ $match: { <query> } },
]);
Expand All @@ -41,13 +49,15 @@ db.workers.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/match/")

[Voltar para Sumário](#sumário)

---

### $limit

**Template**

```javascript
```
db.collection.aggregate([
{ $limit: <inteiro positivo> },
]);
Expand All @@ -64,13 +74,15 @@ db.products.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/limit/")

[Voltar para Sumário](#sumário)

---

### $group

**Template**

```javascript
```
db.collection.aggregate([
{
$group: {
Expand Down Expand Up @@ -98,13 +110,15 @@ db.products.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/group/")

[Voltar para Sumário](#sumário)

---

### $project

**Template**

```javascript
```
db.collection.aggregate([
{
project: {
Expand Down Expand Up @@ -133,13 +147,15 @@ db.products.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/project)

[Voltar para Sumário](#sumário)

---

### $unwind

**Template**

```javascript
```
db.collection.aggregate([
{ $unwind: <caminho do campo array> },
]);
Expand All @@ -155,13 +171,15 @@ db.streamings.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/unwind/)

[Voltar para Sumário](#sumário)

---

### $lookup

**Template**

```javascript
```
db.collection.aggregate([
{
$lookup: {
Expand Down Expand Up @@ -191,6 +209,8 @@ db.orders.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/)

[Voltar para Sumário](#sumário)

---

### $lookup (let/pipeline)
Expand Down Expand Up @@ -241,6 +261,8 @@ db.orders.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/)

[Voltar para Sumário](#sumário)

---

### $addFields
Expand Down Expand Up @@ -281,6 +303,8 @@ db.school.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/addFields/)

[Voltar para Sumário](#sumário)

## Operadores Aritméticos

### $add
Expand Down Expand Up @@ -316,6 +340,8 @@ db.products.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/add/)

[Voltar para Sumário](#sumário)

---

### $subtract
Expand Down Expand Up @@ -357,6 +383,8 @@ db.products.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/subtract/)

[Voltar para Sumário](#sumário)

---

### $ceil
Expand Down Expand Up @@ -392,6 +420,8 @@ db.movies.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/ceil/)

[Voltar para Sumário](#sumário)

---

### $floor
Expand Down Expand Up @@ -428,6 +458,8 @@ db.movies.aggregate([

[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/floor/)

[Voltar para Sumário](#sumário)

---

### $abs
Expand Down Expand Up @@ -461,6 +493,8 @@ db.operations.aggregate([
```
[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/abs/)

[Voltar para Sumário](#sumário)

---

### $multiply
Expand Down Expand Up @@ -499,6 +533,8 @@ db.operations.aggregate([
```
[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/multiply/)

[Voltar para Sumário](#sumário)

---

### $divide
Expand Down Expand Up @@ -533,4 +569,6 @@ db.employees.aggregate([
```
[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/divide/)

[Voltar para Sumário](#sumário)

---

0 comments on commit 846849d

Please sign in to comment.