code: private static IndexOptions prepareOptions(MongoDBIndexType indexType, Document options, String indexName, boolean unique) {
  		IndexOptions indexOptions = new IndexOptions();
  		indexOptions.name( indexName ).unique( unique ).background( options.getBoolean( "background" , false ) );
  
  		if ( unique ) {
  			// MongoDB only allows one null value per unique index which is not in line with what we usually consider
  			// as the definition of a unique constraint. Thus, we mark the index as sparse to only index values
  			// defined and avoid this issue. We do this only if a partialFilterExpression has not been defined
  			// as partialFilterExpression and sparse are exclusive.
  			indexOptions.sparse( !options.containsKey( "partialFilterExpression" ) );
  		}
  		else if ( options.containsKey( "partialFilterExpression" ) ) {
  			indexOptions.partialFilterExpression( (Bson) options.get( "partialFilterExpression" ) );
  		}
  		if ( options.containsKey( "expireAfterSeconds" ) ) {
  			//@todo is it correct?
  			indexOptions.expireAfter( options.getInteger( "expireAfterSeconds" ).longValue() , TimeUnit.SECONDS );
  
  		}
  
  		if ( MongoDBIndexType.TEXT.equals( indexType ) ) {
  			// text is an option we take into account to mark an index as a full text index as we cannot put "text" as
  			// the order like MongoDB as ORM explicitly checks that the order is either asc or desc.
  			// we remove the option from the Document so that we don't pass it to MongoDB
  			if ( options.containsKey( "default_language" ) ) {
  				indexOptions.defaultLanguage( options.getString( "default_language" ) );
  			}
  			if ( options.containsKey( "weights" ) ) {
  				indexOptions.weights( (Bson) options.get( "weights" ) );
  			}
  
  			options.remove( "text" );
  		}
  		return indexOptions;
  	}
docs: Prepare the options by adding additional information to them.
  @see <a href="https://docs.mongodb.com/manual/core/index-ttl/">TTL Indexes</a>