Mongodb Atlas: not authorized on admin to execute command

前端 未结 9 1854
情书的邮戳
情书的邮戳 2021-02-12 18:08

I have a MongoDB Atlas cluster within which I am trying to simply copy a database within the same instance. Unfortunately, every time I try to run db.copyDatabase() or copydb ad

相关标签:
9条回答
  • 2021-02-12 18:39

    In case you have been using mongoose, I solved a similar error updating mongoose to latest version (based on this post).

    0 讨论(0)
  • 2021-02-12 18:40

    this error is because you are trying create the colecction above admin, in atlas this isn't possible because securty.

    in this case you need to use the word key use [collection_name]

    this is the link for this answer.

    it is in spanish.

    https://victorroblesweb.es/2016/12/24/crear-una-base-datos-mongodb/

    0 讨论(0)
  • 2021-02-12 18:42

    I had faced a similar obstacle and spent hours, the problem was with the connection string provided by mongodb atlas which is: mongodb+srv://username:password@clusterName-jynkd.mongodb.net/test?retryWrites=true

    I used a different connection string and worked perfectly. This is it: mongodb://username:password@clusterName+port/yourdb?retryWrites=true&ssl=true&authSource=admin. Make sure the clustername + port are like this: clusterName-shard-00-00-jynkd.mongodb.net:27017

    0 讨论(0)
提交回复
热议问题