Mongodb database is deployed on the cloud server, and super administrators are set up according to the online procedures.
However, using this account link in node will still show that there is no permission.
Here is my node code.
var url = "mongodb://kezuncheng:123456@127.0.0.1:27017/";
router.post('/register', (req, res) => {
MongoClient.connect(url, (err, db) => {
if (err) {
console.log(err);
return;
}
const test = db.db("admin");
test.collection('users').find({ username: req.body.username }).toArray((err, result) => {
if (err) {
res.send(err);
return;
}
//
//
})
});
});
I would like to ask what is the problem?
Try replacing test.collection(‘users’) with test.collection(‘system.users’)?