glynnbird commented on issue #350:
URL: https://github.com/apache/couchdb-nano/issues/350#issuecomment-2915686775

   I tried this with the latest CouchDB 3.5 and the latest Nano 10.1.4:
   
   ```js
   const Nano = require('nano')
   const nano = Nano(process.env.COUCH_URL)
   
   async function main() {
   
     const test = nano.db.use('test')
     const opts = {
       since: 'now',
       feed: 'continuous',
       include_docs: true
     }
     test.changesAsStream(opts).pipe(process.stdout)
   
   }
   main()
   ```
   
   Adding data:
   
   ```sh
   ccurl -X POST -d'{"a":1}' /test             
   {
     "ok": true,
     "id": "c77906581adaefba3eb6190c260025f3",
     "rev": "1-23202479633c2b380f79507a776743d5"
   }
   ```
   
   Edit data:
   
   ```sh
   ccurl -X POST 
-d'{"_id":"c77906581adaefba3eb6190c260025f3","_rev":"1-23202479633c2b380f79507a776743d5","a":2}'
 /test
   {
     "ok": true,
     "id": "c77906581adaefba3eb6190c260025f3",
     "rev": "2-71173597778497e0a6aa176963f222db"
   }
   ```
   
   Fetch data:
   
   ```sh
   ccurl /test/c77906581adaefba3eb6190c260025f3
   {
     "_id": "c77906581adaefba3eb6190c260025f3",
     "_rev": "2-71173597778497e0a6aa176963f222db",
     "a": 2
   }
   ```
   
   and I got two events:
   
   ```js
   
{"seq":"15-g1AAAACbeJzLYWBgYMpgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUklMiTV____PyuDOZEjFyjAnmJobmFslIpNAx5j8liAJEMDkPoPNY0dbJqRgaFpiqURNn1ZAF68MEo","id":"c77906581adaefba3eb6190c260025f3","changes":[{"rev":"1-23202479633c2b380f79507a776743d5"}],"doc":{"_id":"c77906581adaefba3eb6190c260025f3","_rev":"1-23202479633c2b380f79507a776743d5","a":1}}
   
   
{"seq":"16-g1AAAACbeJzLYWBgYMpgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUklMiTV____PyuDOZEjFyjAnmJobmFslIpNAx5j8liAJEMDkPqPYpqRgaFpiqURNn1ZAF7eMEs","id":"c77906581adaefba3eb6190c260025f3","changes":[{"rev":"2-71173597778497e0a6aa176963f222db"}],"doc":{"_id":"c77906581adaefba3eb6190c260025f3","_rev":"2-71173597778497e0a6aa176963f222db","a":2}}
   ```
   
   one for the insert, and one for the update. 
   
   Fetching a document does not trigger a changes feed event in CouchDB, and 
Nano is simply doing a CouchDB changes feed request without any magic.
   
   I should point out that the CouchDB promises to deliver each change _at 
least once_ not _only once_. 


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