From f23b46cfc09fdf9f3dc88c1ca63fb83098657087 Mon Sep 17 00:00:00 2001 From: tidwall Date: Sat, 4 Jul 2020 10:35:07 -0700 Subject: [PATCH] Hotfix for previous commit --- internal/server/scanner.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/server/scanner.go b/internal/server/scanner.go index 0bb877ee..994ec82e 100644 --- a/internal/server/scanner.go +++ b/internal/server/scanner.go @@ -399,14 +399,14 @@ func (sw *scanWriter) writeObject(opts ScanWriterParams) bool { } } else if len(sw.farr) > 0 { - fvs := orderFields(sw.fmap, sw.farr, opts.fields) jsfields = `,"fields":[` - for i, fv := range fvs { + for i, name := range sw.farr { if i > 0 { jsfields += `,` } - if len(opts.fields) > i { - jsfields += strconv.FormatFloat(fv.value, 'f', -1, 64) + j := sw.fmap[name] + if j < len(opts.fields) { + jsfields += strconv.FormatFloat(opts.fields[j], 'f', -1, 64) } else { jsfields += "0" }