_ensureIndexes = async() => {
    const autoIndex = utils.getOption(
      'autoIndex',
      this.schema.options,
      conn.config,
      conn.base.options
    );
    if (!autoIndex) {
      return;
    }
    return await this.ensureIndexes({ _automatic: true });
  }
This function is responsible for initializing the underlying connection in MongoDB based on schema options.
This function performs the following operations:

- `createCollection()` unless [`autoCreate`](https://mongoosejs.com/docs/guide.html#autoCreate) option is turned off
- `ensureIndexes()` unless [`autoIndex`](https://mongoosejs.com/docs/guide.html#autoIndex) option is turned off
- `createSearchIndex()` on all schema search indexes if `autoSearchIndex` is enabled.

Mongoose calls this function automatically when a model is a created using
[`mongoose.model()`](https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.model()) or
[`connection.model()`](https://mongoosejs.com/docs/api/connection.html#Connection.prototype.model()), so you
don't need to call `init()` to trigger index builds.

However, you _may_ need to call `init()`  to get back a promise that will resolve when your indexes are finished.
Calling `await Model.init()` is helpful if you need to wait for indexes to build before continuing.
For example, if you want to wait for unique indexes to build before continuing with a test case.

#### Example:

    const eventSchema = new Schema({ thing: { type: 'string', unique: true } })
    // This calls `Event.init()` implicitly, so you don't need to call
    // `Event.init()` on your own.
    const Event = mongoose.model('Event', eventSchema);

    await Event.init();
    console.log('Indexes are done building!');

@api public
@returns {Promise}