简体   繁体   English

我收到这个错误。 MongoServerError:不允许用户对 [shoeDatabase.users] 执行操作 [remove]

[英]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:您的错误的解决方案是:

  • change the rights in the database更改数据库中的权限
  • your script has not rights to remove any user您的脚本无权删除任何user

there are other problems to address:还有其他问题需要解决:

  • await User.remove({}); will remove all present users... are you sure?将删除所有当前用户...您确定吗?
  • where are users originated from? users来自哪里? (should be parsed from req and are not) (应该从 req 解析而不是)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MongoServerError:不允许用户在 [genius-car.service] 上执行操作 [find] - MongoServerError: user is not allowed to do action [find] on [genius-car.service] MongoError:不允许用户在 [test.users] 上执行操作 [find] - MongoError: user is not allowed to do action [find] on [test.users] 弃用警告后显示“不允许用户执行操作” - “User is not allowed to do action” following a DeprecationWarning 我正在使用 mongoDB 图集,但出现了 MongoServerError。 当我在没有 .env 文件的情况下使用时,一切都很好,但是使用 env 会抛出错误 - I am using mongoDB atlas and I am getting MongoServerError. When I am using without .env file every thing is fine but with env it is throwing error MongoError:不允许用户在 [test.tours] 上执行操作 [插入] - MongoError: user is not allowed to do action [insert] on [test.tours] 在 sequelize 连接中,我收到操作超时错误。 如何解决这个问题? - In sequelize connection I am getting operation timeout error. How to fix this issue? 错误信息:MongoServerError: bad auth:Authentication failed - Error message : MongoServerError: bad auth :Authentication failed 我在 MongoDB 中收到错误“错误:用户验证失败” - I am getting an error "Error: User validation failed" in MongoDB 收到 405 错误 - 不允许 POST? - getting a 405 error - POST is not allowed? MongoServerError:聚合期间的PlanExecutor错误如何修复? - MongoServerError: PlanExecutor error during aggregation how to fix?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM