func (li *ListIndexes) BatchSize(batchSize int32) *ListIndexes {
	if li == nil {
		li = new(ListIndexes)
	}
	li.batchSize = &batchSize
	return li
}
BatchSize specifies the number of documents to return in every batch.
package operation
import (
	"context"
	"errors"
	"go.mongodb.org/mongo-driver/event"
	"go.mongodb.org/mongo-driver/mongo/description"
	"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 ListIndexes struct {
	batchSize  *int32
	maxTimeMS  *int64
	session    *session.Client
	clock      *session.ClusterClock
	collection string
	monitor    *event.CommandMonitor
	database   string
	deployment driver.Deployment
	selector   description.ServerSelector
	retry      *driver.RetryMode
	crypt      *driver.Crypt
	result driver.CursorResponse
}
func NewListIndexes() *ListIndexes {
	return &ListIndexes{}
}
func (li *ListIndexes) Result(opts driver.CursorOptions) (*driver.BatchCursor, error) {
	clientSession := li.session
	clock := li.clock
	return driver.NewBatchCursor(li.result, clientSession, clock, opts)
}
func (li *ListIndexes) processResponse(response bsoncore.Document, srvr driver.Server, desc description.Server, _ int) error {
	var err error
	li.result, err = driver.NewCursorResponse(response, srvr, desc)
	return err
}
func (li *ListIndexes) Execute(ctx context.Context) error {
	if li.deployment == nil {
		return errors.New("the ListIndexes operation must have a Deployment set before Execute can be called")
	}
	return driver.Operation{
		CommandFn:         li.command,
		ProcessResponseFn: li.processResponse,
		Client:         li.session,
		Clock:          li.clock,
		CommandMonitor: li.monitor,
		Database:       li.database,
		Deployment:     li.deployment,
		Selector:       li.selector,
		Crypt:          li.crypt,
		Legacy:         driver.LegacyListIndexes,
		RetryMode:      li.retry,
		Type:           driver.Read,
	}.Execute(ctx, nil)
}
func (li *ListIndexes) command(dst []byte, desc description.SelectedServer) ([]byte, error) {
	dst = bsoncore.AppendStringElement(dst, "listIndexes", li.collection)
	cursorIdx, cursorDoc := bsoncore.AppendDocumentStart(nil)
	if li.batchSize != nil {
		cursorDoc = bsoncore.AppendInt32Element(cursorDoc, "batchSize", *li.batchSize)
	}
	if li.maxTimeMS != nil {
		dst = bsoncore.AppendInt64Element(dst, "maxTimeMS", *li.maxTimeMS)
	}
	cursorDoc, _ = bsoncore.AppendDocumentEnd(cursorDoc, cursorIdx)
	dst = bsoncore.AppendDocumentElement(dst, "cursor", cursorDoc)
	return dst, nil
}