From 1672e8f8fdaa999dec35a9dbd8e7ea692cfcf36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Thu, 9 Nov 2023 09:36:41 +0100 Subject: [PATCH] v0.0.306 --- goextVersion.go | 4 ++-- wmo/queryInsert.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) 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 +}