How can mongodb server release memory after usage?

I am using mongodb 5.0 to hold a dataset made by myself, but everytime after I update data using pymongo client, the mongodb server takes up much memory and doesnt release… I can only restart to release it. Anyone knows how to solve this ??

See the following. It might help you fine-tune your system.

Thanks for showing this, I’ve seen this before but it can only adjust the memory usage when i use the database. My problem is , when I have finished my interaction with the database using pymongo client,even if after client.closed( ) , the memory does not release however… what I need is as how it does in mongodb compass, after I close the compass, the memory is released at the same time… Any idea on it ?

I do not think that Compass does anything special to have mongod release any memory. The memory released is certainly the one used by Compass.

Do you terminate your pymongo application after client.closed?

As far as I observe, when I open and inspect the database in the compass, the memory used by mongo server goes up to 60%. and when i closed the compass, it goes down . I guess the memory maintained for information of the specific database is released? But when I connect and manipulate the database using python, when pymongo client is closed and python program is terminated, the memory usage is still at 60%… How can i do with it?