diff --git a/goextVersion.go b/goextVersion.go index 6b80726..d4a07b9 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.305" +const GoextVersion = "0.0.306" -const GoextVersionTimestamp = "2023-11-09T09:35:56+0100" +const GoextVersionTimestamp = "2023-11-09T09:36:41+0100" diff --git a/wmo/queryInsert.go b/wmo/queryInsert.go index 595f6b0..ef76014 100644 --- a/wmo/queryInsert.go +++ b/wmo/queryInsert.go @@ -43,3 +43,13 @@ func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (*mongo.I return insRes, nil } + +// InsertManyUnchecked behaves the same as InsertOne, but allows arbitrary data to be inserted (valueIn is []any instead of []TData) +func (c *Coll[TData]) InsertManyUnchecked(ctx context.Context, valueIn []any) (*mongo.InsertManyResult, error) { + insRes, err := c.coll.InsertMany(ctx, langext.ArrayToInterface(valueIn)) + if err != nil { + return nil, exerr.Wrap(err, "mongo-query[insert-many] failed").Int("len(valueIn)", len(valueIn)).Str("collection", c.Name()).Build() + } + + return insRes, nil +}