How to release memory in mongodb

if mongodb has been used for a long time, the memory footprint will continue to rise. It is not good to shut down the database and release memory. Is there any better way to free the memory occupied by mongodb?

Mar.30,2021

the data in memory is all hot data. You free memory, although reducing memory footprint, but at the expense of a certain amount of access performance.
what needs to be done is performance optimization. Not just freeing up memory.
there are many ways to optimize. At the hardware level, you can add ssd, machine (sharding), memory, etc.; at the software level, you can analyze which are high-frequency access, which are bulk, and which are time-consuming operations. Treat them separately.

analyze the hardware performance first, and then analyze the mongo itself. There is no flat hammer.
mongo analysis tools are: mongostat , db.currentOP () , sh.status () , db.status () .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3fcd5-2c4ba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3fcd5-2c4ba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?