title: Getting current mongo user roles in spring
body: <p>I'm using spring with mongo 3.4 and trying to create databases programmatically, but before doing this I want to check if the mongo user have the privileges on mongo server to create databases. For this I'm trying to get the roles of the user without success.</p>
  <p>Tried this way adapted from <a href="https://stackoverflow.com/questions/34636908/javamongodb-grantrolestouser">other post</a>, but without success:</p>
  <pre><code>MongoClient dbCheckClient = new MongoClient();
  MongoDatabase adminDatabase = dbCheckClient.getDatabase(&quot;admin&quot;);
  Document doc = adminDatabase.runCommand(new Document(&quot;getUsers&quot;, &quot;&quot;));
  </code></pre>
  <p>Any way to do this?</p>