opt 1) mongodb 3.6:
use admin
db.createUser(
{
user: "restricted",
pwd: "password",
roles: [ { role: "readWrite", db: "reporting } ],
authenticationRestrictions: [ {
clientSource: ["40.0.0.0","12.0.0.0"],
serverAddress: ["120.0.0.0"]
} ]
}
)
opt 2) Через брандмауэр операционной системы