class_docstr: Wrap MongoDB with three primary methods `read`, `write`, `remove`.
  
  Attributes
  ----------
  host : str
     Hostname or MongoDB compliant full credentials+address+database
     specification.
  
  Information on MongoDB `connection string
  <https://docs.mongodb.com/manual/reference/connection-string/>`_.
  
  .. seealso:: :class:`orion.core.io.database.Database` for more on attributes.
docstr: Create given indexes if they do not already exist in database.
  
  .. seealso:: :meth:`orion.core.io.database.Database.ensure_index` for argument
      documentation.
docstr_tok: ["Create","given","indexes","if","they","do","not","already","exist","in","database",".","..","seealso",":",":",":","meth",":","`","orion.core.io.database.Database.ensure_index","`","for","argument","documentation","."]
code: def ensure_index(self, collection_name, keys, unique=False):
      """Create given indexes if they do not already exist in database.
  
      .. seealso:: :meth:`orion.core.io.database.Database.ensure_index` for argument
          documentation.
  
      """
      # MongoDB's `create_index()` is idempotent, which means it will only
      # create new indexes if they do not already exists. That's why we do
      # not need to verify if indexes already exists.
      dbcollection = self._db[collection_name]
  
      keys = self._convert_index_keys(keys)
  
      dbcollection.create_index(keys, unique=unique, background=True)
  
imports: import functools
  import pymongo
  from orion.core.io.database import Database, DatabaseError, DatabaseTimeout, DuplicateKeyError
label_desc: Use image node_id 8 for calling the MongoDB obj's underlying member method code with example usage: obj.ensure_index(collection_name, keys, unique) without return types