Skip to content

Commit

Permalink
Merge com a master
Browse files Browse the repository at this point in the history
  • Loading branch information
cleytonoliveira committed Mar 9, 2021
2 parents 31f4ccf + 29a5846 commit e891e18
Showing 1 changed file with 67 additions and 61 deletions.
128 changes: 67 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
# Sumário

- [Operadores](#operadores)
- [$lookup (let/pipeline)](#lookup-letpipeline)
- [$add](#add)
- [$subtract](#subtract)
- [$ceil](#ceil)
- [$floor](#floor)
- [$abs](#abs)
- [$multiply](#multiply)
- [$divide](#divide)
- [$addFields](#addfields)
- [Operadores Aggregation](#operadores-aggregation)
- [$lookup (let/pipeline)](#lookup-letpipeline)
- [$addFields](#addfields)
- [Operadores Aritméticos](#operadores-aritméticos)
- [$add](#add)
- [$subtract](#subtract)
- [$ceil](#ceil)
- [$floor](#floor)
- [$abs](#abs)
- [$multiply](#multiply)
- [$divide](#divide)

---

# Operadores

## $match
## Operadores Aggregation

### $match

**Template**

Expand All @@ -39,7 +43,7 @@ db.workers.aggregate([

---

## $limit
### $limit

**Template**

Expand All @@ -62,7 +66,7 @@ db.products.aggregate([

---

## $group
### $group

**Template**

Expand Down Expand Up @@ -96,7 +100,7 @@ db.products.aggregate([

---

## $project
### $project

**Template**

Expand Down Expand Up @@ -131,7 +135,7 @@ db.products.aggregate([

---

## $unwind
### $unwind

**Template**

Expand All @@ -153,7 +157,7 @@ db.streamings.aggregate([

---

## $lookup
### $lookup

**Template**

Expand Down Expand Up @@ -189,7 +193,7 @@ db.orders.aggregate([

---

## $lookup (let/pipeline)
### $lookup (let/pipeline)

**Template**

Expand Down Expand Up @@ -239,7 +243,47 @@ db.orders.aggregate([

---

## $add
### $addFields

**Template**

```
db.collection.aggregate([
{
$addFields: {
<novoCampo1>: <valor> ,
<novoCampo2>: <valor> ,
...
},
},
]);
```

**Exemplo**

```javascript
db.school.aggregate([
{
$addFields: {
totalHomework: { $sum: "$homework" } ,
totalQuiz: { $sum: "$quiz" }
},
},
{
$addFields: {
totalScore: {
$add: [ "$totalHomework", "$totalQuiz", "$extraCredit" ]
},
},
},
]);
```

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

## Operadores Aritméticos

### $add

**Template**

Expand Down Expand Up @@ -274,7 +318,7 @@ db.products.aggregate([

---

## $subtract
### $subtract

**Template**

Expand Down Expand Up @@ -315,7 +359,7 @@ db.products.aggregate([

---

## $ceil
### $ceil

**Template**

Expand Down Expand Up @@ -350,7 +394,7 @@ db.movies.aggregate([

---

## $floor
### $floor

**Template**

Expand Down Expand Up @@ -386,7 +430,7 @@ db.movies.aggregate([

---

## $abs
### $abs

**Template**

Expand Down Expand Up @@ -419,7 +463,7 @@ db.operations.aggregate([

---

## $multiply
### $multiply

**Template**

Expand Down Expand Up @@ -457,7 +501,7 @@ db.operations.aggregate([

---

## $divide
### $divide

**Template**

Expand Down Expand Up @@ -490,41 +534,3 @@ db.employees.aggregate([
[Documentação](https://docs.mongodb.com/manual/reference/operator/aggregation/divide/)

---

## $addFields

**Template**

```
db.collection.aggregate([
{
$addFields: {
<novoCampo1>: <valor> ,
<novoCampo2>: <valor> ,
...
},
},
]);
```

**Exemplo**

```javascript
db.school.aggregate([
{
$addFields: {
totalHomework: { $sum: "$homework" } ,
totalQuiz: { $sum: "$quiz" }
},
},
{
$addFields: {
totalScore: {
$add: [ "$totalHomework", "$totalQuiz", "$extraCredit" ]
},
},
},
]);
```

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

0 comments on commit e891e18

Please sign in to comment.