diff --git a/data/store/mongo/mongo_data_set.go b/data/store/mongo/mongo_data_set.go index 05b4ecb7c7..1928723222 100644 --- a/data/store/mongo/mongo_data_set.go +++ b/data/store/mongo/mongo_data_set.go @@ -323,14 +323,14 @@ func (d *DataSetRepository) GetDataSetsForUserByID(ctx context.Context, userID s SetSort(bson.M{"createdTime": -1}) cursor, err := d.Find(ctx, selector, opts) - loggerFields := log.Fields{"userId": userID, "dataSetsCount": len(dataSets), "duration": time.Since(now) / time.Microsecond} - log.LoggerFromContext(ctx).WithFields(loggerFields).WithError(err).Debug("GetDataSetsForUserByID") - if err != nil { return nil, errors.Wrap(err, "unable to get data sets for user by id") } - if err = cursor.All(ctx, &dataSets); err != nil { + err = cursor.All(ctx, &dataSets) + loggerFields := log.Fields{"userId": userID, "dataSetsCount": len(dataSets), "duration": time.Since(now) / time.Microsecond} + log.LoggerFromContext(ctx).WithFields(loggerFields).WithError(err).Debug("GetDataSetsForUserByID") + if err != nil { return nil, errors.Wrap(err, "unable to decode data sets for user by id") }