Bạn có thể thêm phần sau vào tệp cấu hình được cung cấp khi chạy mongod --config mongod.conf
Đối với MongoDB 3.x (phiên bản mới nhất)
storage:
mmapv1:
smallFiles: true
Đối với phiên bản 2.6+
storage:
smallFiles: true
Đối với phiên bản 2.4 và ít hơn
smallfiles = true
Sau đó, chỉ cần thực thi mongod để chấp nhận tệp cấu hình của bạn (ở đây nó giả định rằng vị trí của cấu hình là /etc/mongodb.conf ):
mongod -f /etc/mongodb.conf
Tài liệu cho tệp nhỏ tham số:
Set to true to modify MongoDB to use a smaller default data file size.
Specifically, smallfiles reduces the initial size for data files and
limits them to 512 megabytes. The smallfiles setting also reduces the
size of each journal files from 1 gigabyte to 128 megabytes.