MongoDB - 如何向用户添加findandmodify权限

She*_*ose 9 mongoose mongodb express

在我的应用程序中,我使用MongoDB作为数据库并Express + Mongoose处理代码.我已将用户添加到数据库并readWrite为用户授予角色,现在我可以从数据库中获取数据.但是,当我尝试使用该save函数插入集合时,Express + Mongoose我收到以下错误消息,我找不到如何将findandmodify权限添加到用户.

 {"name":"MongoError",
   "ok":0,
   "errmsg":"not authorized on od-database to execute  command { findandmodify: \"identitycounters\", 
   query: {
      field: \"id\",  
      model: \"Products\" },
   new: 1 , 
   remove: 0, 
   upsert: 0,
   update: { $inc: { count: 1 } } }","code":13}
Run Code Online (Sandbox Code Playgroud)

请帮我.

Ama*_*ros 0

尝试让他扮演这个dbAdmin角色。