v0.0.306
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m12s

This commit is contained in:
Mike Schwörer 2023-11-09 09:36:41 +01:00
parent 398ed56d32
commit 1672e8f8fd
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 12 additions and 2 deletions

View File

@ -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"

View File

@ -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
}