This commit is contained in:
Stephan D
2026-03-10 12:31:09 +01:00
parent d87e709f43
commit e77d1ab793
287 changed files with 2089 additions and 1550 deletions

View File

@@ -45,7 +45,8 @@ func NewMongoTimeSeriesCollection(ctx context.Context, db *mongo.Database, tsOpt
}
if err := db.CreateCollection(ctx, tsOpts.Collection, collOpts); err != nil {
if cmdErr, ok := err.(mongo.CommandError); !ok || cmdErr.Code != 48 {
var cmdErr mongo.CommandError
if !errors.As(err, &cmdErr) || cmdErr.Code != 48 {
return nil, err
}
}
@@ -86,7 +87,9 @@ func (ts *TimeSeries) executeQuery(ctx context.Context, decoder rdecoder.Decodin
if err != nil {
return err
}
defer cursor.Close(ctx)
defer func() {
_ = cursor.Close(ctx)
}()
for cursor.Next(ctx) {
if err := cursor.Err(); err != nil {