grain/events/unhandled.go

19 lines
391 B
Go
Raw Normal View History

2024-07-23 00:08:04 +00:00
package events
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/mongo"
)
func HandleUnknownEvent(ctx context.Context, evt Event, collection *mongo.Collection) error {
_, err := collection.InsertOne(ctx, evt)
if err != nil {
return fmt.Errorf("Error inserting unknown event into MongoDB: %v", err)
}
fmt.Println("Inserted unknown event into MongoDB:", evt.ID)
return nil
}