[英]Am getting this error. MongoServerError: user is not allowed to do action [remove] on [shoeDatabase.users]
This error is what I find.这个错误是我发现的。 user is not allowed to do action MongoServerError: user is not allowed to do action [remove] on [shoeDatabase.users],
不允许用户执行操作MongoServerError: user is not allowed to do action [remove] on [shoeDatabase.users],
import express from "express";
import User from "./Models/UserModel.js";
import users from "./data/users.js";
const ImportData = express.Router();
ImportData.post("/user", async (req, res) => {
await User.remove({});
const importUser = await User.insertMany(users);
res.send({ importUser });
});
export default ImportData;
solution for your error is:您的错误的解决方案是:
user
您的脚本无权删除任何user
there are other problems to address:还有其他问题需要解决:
await User.remove({});
will remove all present users... are you sure?将删除所有当前用户...您确定吗?users
originated from? users
来自哪里? (should be parsed from req and are not) (应该从 req 解析而不是)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.