How to add mongodb service under Windows 10?

clipboard.png
the previous command is as follows:

mongod --logpath C:\mydatabase\logs.txt --logappend --dbpath C:\mydatabase --serviceName MongoDB --install

however, there is no prompt on the command line after entering the carriage enter, and the service has not been added successfully.
I have tried some methods on the Internet that do not work. Is there a correct one available?

Feb.26,2021

"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\3.6\mongod.cfg" --install

net start MongoDB
3.4
win10mongoDb

problem solved, open cmd, as an administrator or enter this command. Note that you cannot create a service when you open mongodb.

Menu