You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{b:2, a:1} // Member order does matter for collation.
// CouchDB preserves member order
// but doesn't require that clients will.
// this test might fail if used with a js engine
// that doesn't preserve order
We don't honor this, becuase Go maps are not ordered.
In principle, we may be able to work around this limitation, but it's non-trivial. A first attempt was to pass raw JSON to the JS function, then call JSON.parse, but as documented, goja's JSON.parse uses the underlying Go encoding/json package, which does not preserve order. So the work-around probably involves passing a custom data type to the goja runtime, which is then, in JS space, converted to a standard JS object, before being passed to the map and reduce functions. This is likely complex, and will hurt performance. So I prefer not to do it, unless this proves a difficult problem for users.
The text was updated successfully, but these errors were encountered:
The CouchDB documentation specifies that:
We don't honor this, becuase Go maps are not ordered.
In principle, we may be able to work around this limitation, but it's non-trivial. A first attempt was to pass raw JSON to the JS function, then call
JSON.parse
, but as documented, goja'sJSON.parse
uses the underlying Goencoding/json
package, which does not preserve order. So the work-around probably involves passing a custom data type to the goja runtime, which is then, in JS space, converted to a standard JS object, before being passed to themap
andreduce
functions. This is likely complex, and will hurt performance. So I prefer not to do it, unless this proves a difficult problem for users.The text was updated successfully, but these errors were encountered: