poor-a opened a new pull request, #6057:
URL: https://github.com/apache/couchdb/pull/6057

   <!-- Thank you for your contribution!
   
        Please file this form by replacing the Markdown comments
        with your text. If a section needs no action - remove it.
   
        Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
        of code collaboration. Positive feedback is represented +1 from 
committers
        and negative is a -1. The -1 also means veto, and needs to be addressed
        to proceed. Once there are no objections, the PR can be merged by a
        CouchDB committer.
   
        See: http://couchdb.apache.org/bylaws.html#decisions for more info.
   
        Artificial Intelligence and Large Language Models Contributions Policy
   
        It is expressly forbidden to contribute material generated by
        AI, LLMs, and similar technologies, to the CouchDB project. 
        This includes, but is not limited to, source code, documentation,
        commit messages, or any other areas of the project.
   
   -->
   
   ## Overview
   
   There is a typo in 
https://docs.couchdb.org/en/stable/partitioned-dbs/index.html:
   ```
   function(doc) {
       if(doc._id.indexOf(":sensor-reading-") < 0) {
           return;
       }
       for(var r in doc.readings) {
           emit([doc.sensor_id, r[0]], r[1])
       }
   }
   ```
   
   The `for...in` loop above assigns indices in `docs.readings` array to 
variable `r`: 0, 1, ... n. To iterate over _elements_ in the array, `for...of` 
should be written:
   ```
       for(var r of doc.readings) {
           emit([doc.sensor_id, r[0]], r[1])
       }
   ```
   
   ## Checklist
   
   - [x] This is my own work, I did not use AI, LLM's or similar technology
   - [x] Documentation changes were made in the `src/docs` folder
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to