From aeb273738d737c5083f574572a4833fa738e4c59 Mon Sep 17 00:00:00 2001 From: Nikita Tokarchuk Date: Tue, 19 Feb 2019 18:28:13 +0100 Subject: [PATCH] Do not increase offset if obj was not appended --- mongox/common/loadarray.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mongox/common/loadarray.go b/mongox/common/loadarray.go index b7ce0c2..5505464 100644 --- a/mongox/common/loadarray.go +++ b/mongox/common/loadarray.go @@ -53,6 +53,8 @@ func LoadArray(db *mongox.Database, target interface{}, filters ...interface{}) elem := reflect.New(targetSliceElemT.Elem()) if result.Decode(elem.Interface()) != nil { targetSliceV = reflect.Append(targetSliceV, elem) + } else { + continue } } else { result.Decode(targetSliceV.Index(i).Interface())