1- Update the MongoDB configuration to allow remote connections:
* Locate the mongod.conf file on the MongoDB server device.
* Find the line starting with bindIp (e.g., bindIp: 127.0.0.1).
* Modify it to include the server's local IP address or 0.0.0.0 to allow connections from all IPs.
* then add those two lines:
security:
authorization: "enabled"
2- install mongo shell and create a new user.
* open mongosh.exe, then enter this command 'mongodb://localhost/'
* enter 'use admin'
* To create a new user, enter this command: db.createUser({user: "admin", pwd: "your_secure_password", roles: [{ role: "root", db: "admin" }]})
* then in Restaurant App open settings screen and set credentials (username and password)
3- Set Up Firewall Rules To allow devices to connect to your MongoDB instance, you need to open the MongoDB port (default is 27017) in your Windows Firewall.
* Open Windows Defender Firewall.
* Go to Advanced Settings > Inbound Rules > New Rule.
* Select Port and click Next.
* Enter the port number (27017) and allow the connection.
* Name the rule (e.g., "MongoDB") and save it.
and restart the server from servecies on windows


المزيد من المقالات حول SETUP


Comments

لا تعليقات حتى الآن. بدء مناقشة جديدة.

أضف تعليق