func (di *DropIndexes) MaxTimeMS(maxTimeMS int64) *DropIndexes {
	if di == nil {
		di = new(DropIndexes)
	}
	di.maxTimeMS = &maxTimeMS
	return di
}
MaxTimeMS specifies the maximum amount of time to allow the query to run.
package operation
import (
	"context"
	"errors"
	"fmt"
	"go.mongodb.org/mongo-driver/event"
	"go.mongodb.org/mongo-driver/mongo/description"
	"go.mongodb.org/mongo-driver/mongo/writeconcern"
	"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
	"go.mongodb.org/mongo-driver/x/mongo/driver"
	"go.mongodb.org/mongo-driver/x/mongo/driver/session"
)
type DropIndexes struct {
	index        *string
	maxTimeMS    *int64
	session      *session.Client
	clock        *session.ClusterClock
	collection   string
	monitor      *event.CommandMonitor
	crypt        *driver.Crypt
	database     string
	deployment   driver.Deployment
	selector     description.ServerSelector
	writeConcern *writeconcern.WriteConcern
	result       DropIndexesResult
}
type DropIndexesResult struct {
	NIndexesWas int32
}
func buildDropIndexesResult(response bsoncore.Document, srvr driver.Server) (DropIndexesResult, error) {
	elements, err := response.Elements()
	if err != nil {
		return DropIndexesResult{}, err
	}
	dir := DropIndexesResult{}
	for _, element := range elements {
		switch element.Key() {
		case "nIndexesWas":
			var ok bool
			dir.NIndexesWas, ok = element.Value().AsInt32OK()
			if !ok {
				err = fmt.Errorf("response field 'nIndexesWas' is type int32, but received BSON type %s", element.Value().Type)
			}
		}
	}
	return dir, nil
}
func NewDropIndexes(index string) *DropIndexes {
	return &DropIndexes{
		index: &index,
	}
}
func (di *DropIndexes) Result() DropIndexesResult { return di.result }
func (di *DropIndexes) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error {
	var err error
	di.result, err = buildDropIndexesResult(response, srvr)
	return err
}
func (di *DropIndexes) Execute(ctx context.Context) error {
	if di.deployment == nil {
		return errors.New("the DropIndexes operation must have a Deployment set before Execute can be called")
	}
	return driver.Operation{
		CommandFn:         di.command,
		ProcessResponseFn: di.processResponse,
		Client:            di.session,
		Clock:             di.clock,
		CommandMonitor:    di.monitor,
		Crypt:             di.crypt,
		Database:          di.database,
		Deployment:        di.deployment,
		Selector:          di.selector,
		WriteConcern:      di.writeConcern,
	}.Execute(ctx, nil)
}
func (di *DropIndexes) command(dst []byte, desc description.SelectedServer) ([]byte, error) {
	dst = bsoncore.AppendStringElement(dst, "dropIndexes", di.collection)
	if di.index != nil {
		dst = bsoncore.AppendStringElement(dst, "index", *di.index)
	}
	if di.maxTimeMS != nil {
		dst = bsoncore.AppendInt64Element(dst, "maxTimeMS", *di.maxTimeMS)
	}
	return dst, nil
}
func (di *DropIndexes) Index(index string) *DropIndexes {
	if di == nil {
		di = new(DropIndexes)
	}
	di.index = &index
	return di
}