![](/img/trans.png)
[英]MongoServerError: user is not allowed to do action [find] on [genius-car.service]
[英]Am getting this error. 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;
您的錯誤的解決方案是:
user
還有其他問題需要解決:
await User.remove({});
將刪除所有當前用戶...您確定嗎?users
來自哪里? (應該從 req 解析而不是)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.