diff --git a/collection_indexes_impl.go b/collection_indexes_impl.go index fd8c4efc..b5c6077c 100644 --- a/collection_indexes_impl.go +++ b/collection_indexes_impl.go @@ -38,7 +38,7 @@ type indexData struct { InBackground *bool `json:"inBackground,omitempty"` Estimates *bool `json:"estimates,omitempty"` MinLength int `json:"minLength,omitempty"` - ExpireAfter int `json:"expireAfter,omitempty"` + ExpireAfter *int `json:"expireAfter,omitempty"` Name string `json:"name,omitempty"` } @@ -255,7 +255,7 @@ func (c *collection) EnsureTTLIndex(ctx context.Context, field string, expireAft input := indexData{ Type: string(TTLIndex), Fields: []string{field}, - ExpireAfter: expireAfter, + ExpireAfter: &expireAfter, } if options != nil { input.InBackground = &options.InBackground