diff --git a/goextVersion.go b/goextVersion.go index 56af569..032bd6d 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.186" +const GoextVersion = "0.0.187" -const GoextVersionTimestamp = "2023-07-24T09:13:19+0200" +const GoextVersionTimestamp = "2023-07-24T09:16:37+0200" diff --git a/wmo/queryInsert.go b/wmo/queryInsert.go index ce7deff..f1eb1c7 100644 --- a/wmo/queryInsert.go +++ b/wmo/queryInsert.go @@ -3,6 +3,8 @@ package wmo import ( "context" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "gogs.mikescher.com/BlackForestBytes/goext/langext" ) func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, error) { @@ -16,13 +18,6 @@ func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, erro return c.decodeSingle(ctx, mongoRes) } -func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (TData, error) { - insRes, err := c.coll.InsertMany(ctx, langext.TovalueIn) - if err != nil { - return *new(TData), err - } - - mongoRes := c.coll.FindOne(ctx, bson.M{"_id": insRes.InsertedID}) - - return c.decodeSingle(ctx, mongoRes) +func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (*mongo.InsertManyResult, error) { + return c.coll.InsertMany(ctx, langext.ArrayToInterface(valueIn)) }