Skip to content

Commit f833005

Browse files
committed
Compact
1 parent 8717a65 commit f833005

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,28 @@ MMAPv1 is a B-tree based system which powers many of the functions such as stora
14141414
<b><a href="#">↥ back to top</a></b>
14151415
</div>
14161416
1417-
#### Q. ***How to condense large volumes of data in Mongo?***
1417+
## Q. ***How to condense large volumes of data in Mongodb?***
1418+
1419+
**compact**
1420+
1421+
Rewrites and defragments all data and indexes in a collection. On `WiredTiger` databases, this command will release unneeded disk space to the operating system. This command will perform a compaction "in-line".
1422+
1423+
MongoDB compresses the files by:
1424+
1425+
* copying the files to a new location
1426+
* looping through the documents and re-ordering / re-solving them
1427+
* replacing the original files with the new files
1428+
1429+
**Syntax**
1430+
1431+
```js
1432+
{ compact: <collection name> }
1433+
```
1434+
1435+
<div align="right">
1436+
<b><a href="#">↥ back to top</a></b>
1437+
</div>
1438+
14181439
#### Q. ***Is it possible to update MongoDB field using value of another field?***
14191440
#### Q. ***How to check if a field contains a substring?***
14201441
#### Q. ***How to find document with array that contains a specific value?***

0 commit comments

Comments
 (0)