You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/04/17 13:46:53 UTC

[GitHub] [couchdb-nano] kozlovzxc opened a new pull request #266: changesreader /added fields & body support

kozlovzxc opened a new pull request #266:
URL: https://github.com/apache/couchdb-nano/pull/266


   ## Overview
   
   <!-- Please give a short brief for the pull request,
        what problem it solves or how it makes things better. -->
   
   This PR is addressing issue #263
   
   In simple words, it is adding support for `fields` and `body` params for changesreader.
   
   ## Testing recommendations
   
   You can run this code against any running CouchDB database e.g. https://registry.npmjs.org/
   
   ```
   db.changesReader
     .start({ fields })
     .on('changes', console.log);
   ```
   
   ## GitHub issue number
   
   #263 
   
   ## Checklist
   
   - [x] Code is written and works correctly;
   - [x] Changes are covered by tests;
   - [x] Documentation reflects the changes;
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] glynnbird commented on a change in pull request #266: changesreader /added fields & body support

Posted by GitBox <gi...@apache.org>.
glynnbird commented on a change in pull request #266:
URL: https://github.com/apache/couchdb-nano/pull/266#discussion_r695601488



##########
File path: lib/changesreader.js
##########
@@ -165,11 +167,17 @@ class ChangesReader {
           if (self.fastChanges) {
             req.qs.seq_interval = self.batchSize
           }
-          if (self.selector) {
+          if (self.selector || self.fields) {
             req.qs.filter = '_selector'
-            req.body.selector = self.selector
+            if (self.selector) {
+              req.body.selector = self.selector
+            }
+            if (self.fields) {

Review comment:
       I don't see anything in the CouchDB docs saying that a `fields` array can be supplied. Am I missing something?

##########
File path: lib/nano.d.ts
##########
@@ -257,18 +257,22 @@ declare namespace nano {
     wait?: boolean;
     /** additional query string parameters */
     qs?: object;
+    /** additional body parameters */
+    body?: object;
     /** a MangoSelector defining the slice of the changes feed to return */
     selector?: MangoSelector;
+    /** a MangoSelector defining changes feed fields to return */

Review comment:
       A small error: this isn't a MangoSelector, it's an array. :)




-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org