Skip to content

Commit 2b96722

Browse files
committed
Update README.md
1 parent f833005 commit 2b96722

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,25 @@ MongoDB compresses the files by:
14361436
<b><a href="#">↥ back to top</a></b>
14371437
</div>
14381438
1439-
#### Q. ***Is it possible to update MongoDB field using value of another field?***
1439+
## Q. ***Is it possible to update MongoDB field using value of another field?***
1440+
1441+
The aggregate function can be used to update MongoDB field using the value of another field.
1442+
1443+
**Example**
1444+
1445+
```js
1446+
db.collection.<update method>(
1447+
{},
1448+
[
1449+
{"$set": {"name": { "$concat": ["$firstName", " ", "$lastName"]}}}
1450+
]
1451+
)
1452+
```
1453+
1454+
<div align="right">
1455+
<b><a href="#">↥ back to top</a></b>
1456+
</div>
1457+
14401458
#### Q. ***How to check if a field contains a substring?***
14411459
#### Q. ***How to find document with array that contains a specific value?***
14421460
#### Q. ***How to find MongoDB records where array field is not empty?***

0 commit comments

Comments
 (0)