title: Creating unique index via mongodb native driver
body: <p>There is a code:</p>
  
  <pre><code>const { MongoClient } = require('mongodb')
  
  const db = MongoClient.connect('mongodb://172.17.0.2:27017/test')
  db
    .then(
      async dataBase =&gt; {
        eduDb = dataBase.db('edu-service-accounts')
        const accounts = eduDb.collection('accounts')
        await accounts.createIndex({ email: 1 }, { unique: true })
        accounts.insertOne({ email: '123' })
      }
    )
  </code></pre>
  
  <p>Code above creates an index, but that is no unique. I already read official docs for native mongoDB driver, but can't handle it.
  And yes, I've deleted all old indexex before testing that code.</p>
  
  <p>Can someone please show a code that really create an index with unique.
  I mean not part of official doc, or something like that - I need code that works. 
  NOTE: I tested that code with local db and mlab - the same result.</p>