Hi. I am trying to create a timeseries collection using golang. My code looks like this:
tso := options.TimeSeries()
tso.SetTimeField("time")
tso.SetMetaField("meta")
tso.SetGranularity("minutes")
cco := options.CreateCollection()
cco.SetTimeSeriesOptions(tso)
err := db.CreateCollection(context.Background(), "data", cco)
if err != nil {
log.Panic(err)
}
I always get the error
panic: (Location40415) BSON field 'create.timeseries' is an unknown field.
The only related post I found was on stack. However, it was not helpful, since I don’t use any validation.
Can someone tell me how to fix it? Or link me some code, where someone has done this before?