Same general premise is used to determine whether MongoDB is running on Windows.
node-netstat package is used to determine whether mongod is running on a given port or PID. node-ps is used to determine if mongod.exe is in the list of processes. It contains support for Windows already.
Note: node-ps currently has issue that if mongodb.exe is executed under another user, then the process cannot be retrieved without administrative rights and that is not given in node-ps. There is a fix for this and I will be submitting a PR soon enough to resolve this. I think in majority of cases, mongod.exe should be run under same user hopefully.
Use Windows equivalent function to check whether mongodb is running. Netstat is used to get MongoDB for a given PID or process. If neither is given, all running processes are analyzed using ps.locate.
Same general premise is used to determine whether MongoDB is running on Windows.
node-netstat package is used to determine whether mongod is running on a given port or PID. node-ps is used to determine if mongod.exe is in the list of processes. It contains support for Windows already.
Note: node-ps currently has issue that if mongodb.exe is executed under another user, then the process cannot be retrieved without administrative rights and that is not given in node-ps. There is a fix for this and I will be submitting a PR soon enough to resolve this. I think in majority of cases, mongod.exe should be run under same user hopefully.
Use Windows equivalent function to check whether mongodb is running. Netstat is used to get MongoDB for a given PID or process. If neither is given, all running processes are analyzed using ps.locate.