File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1436,7 +1436,25 @@ MongoDB compresses the files by:
1436
1436
<b><a href="#">↥ back to top</a></b>
1437
1437
</div>
1438
1438
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
+
1440
1458
#### Q. ***How to check if a field contains a substring?***
1441
1459
#### Q. ***How to find document with array that contains a specific value?***
1442
1460
#### Q. ***How to find MongoDB records where array field is not empty?***
You can’t perform that action at this time.
0 commit comments