For solving your query, you have to check two files:
The first file will be in your the following directory:
sudo vi /Library/LaunchDaemons/limit.maxfiles.plist
That contains the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>65536</string>
<string>65536</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
The second file will be in the following directory:
sudo vi /Library/LaunchDaemons/limit.maxproc.plist
That contains the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxproc</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxproc</string>
<string>2048</string>
<string>2048</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
By looking into the files you have to make sure that both of those files must be owned by root:wheel and must have the permissions as -rw-r--r. To check the above mention things just write:
sudo chmod 644 <filename>
By performing the above-mentioned tasks, the system will then set itself correctly when you restart the system. You can confirm this by typing the following command into your terminal:
launchctl limit
This will set your system’s limits. After that you have to add the following syntaxes at the end of the file:
ulimit -n 65536
ulimit -u 2048
And you also have to make sure that the barshrc file must have -rw-r--r-- permission.
At last, you have to restart your computer and open the terminal. Inside the terminal, you have to write ulimit -n. The result must have the maxfiles as 65536.
Now you will be not seeing the soft rlimits warnings when you will be login into your mongo shell. If you wish to learn more about MongoDB, then go through this MongoDB course and be an expert.