title: MongoDB Atlas: user is not allowed to do action find on system.indexes
body: <p>I'm using MongoDB Atlas and I've recently started to get this error on my MongoDB replica:</p>
  
  <blockquote>
    <p>user is not allowed to do action [find] on [mydb.system.indexes]</p>
  </blockquote>
  
  <p>Nothing really has changed, so I'm wondering what can be  an issue. The user has <code>readWrite</code> role on <code>mydb</code> and from the <a href="https://docs.mongodb.com/manual/reference/built-in-roles/#readWrite" rel="nofollow noreferrer">docs</a> it looks like it should have the right to do it. Also, I've tried to change the user to admin user which has any rights, but still got this error. Interesting that <code>system</code> collection doesn't exists in <code>mydb</code> but Spring Data tries to query it and gets this error.</p>
  
  <p>Here is a full log from mongo:</p>
  
  <pre><code>Error: error: {
      "ok" : 0,
      "errmsg" : "user is not allowed to do action [find] on [mydb.system.indexes]",
      "code" : 8000,
      "codeName" : "AtlasError"
  }
  </code></pre>
  
  <p>MongoDB connection URI looks like this:</p>
  
  <pre><code>spring.data.mongodb.uri=mongodb+srv://[USER]:[PASSWORD]@[MONGO_URL].mongodb.net/mydb
  </code></pre>
  
  <p>I'm using Spring Boot <code>2.0.1.RELEASE</code> with mongo java driver of version <code>3.6.3</code>. Version of the Mongo replica is <code>3.4.14</code>. Any idea what's going on and how this can be fixed? Upgrading user role doesn't help here.</p>