Sort order guarantee for the key argument (value) of the CouchDB reduction function?

As you know, the reduce function in CouchDB views looks like this:

 function (key, values, rereduce) { return sum(values); } 

where the definition of the first arguments is as follows:

when rereduce is false , then:

  • the key will be an array whose elements are arrays of the form [key, id], where the key is the key emitted by the map function, and the identifier is the document from which the key was generated.
  • will be an array of values โ€‹โ€‹emitted for the corresponding elements in the keys.

My question is: when reereduce is false , are there any guarantees regarding the order of the elements in the key (or values ) array? The gut feeling (based on Reduce vs Rereduce ) is that keys and values โ€‹โ€‹must be ordered accordingly, but I don't see any direct confirmation.

Any ideas? Thanks!

+4
source share
1 answer

From https://cloudant.com/for-developers/all_docs/

 Sort Order All indexes are sorted by their key. The sort order is: null false true numbers text, cases sensitive - lower case first arrays, sorted element by element objects 

The full specification is documented in the CouchDB Wiki .

-1
source

Source: https://habr.com/ru/post/1442698/


All Articles