pouchdb: PouchDB query does not return doc with latest revision when Cloudant DB is recreated

PouchDB once synced with remote CloudantDb and the sequence went beyong 10K. Now due to unavoidable circumstances we flushed the remote Cloudant Db and recreated with the exact same doc but only thing all doc now have seq=1-xxxx Now any changes done on Cloudant does bring the updated document with seq=1 or 2 or smaller nos and Pouch DB shows multiple docs with seq=1-xxx (the newer doc) as well with seq=1-yyy (older replicated copy).

But the issue is when we query the PouchDB for any _id it returns the one with highest seq=10K something, and not the one iwht 1-xxx.

I’m using PouchDB v5.4.5 in hybrid Ionic App.

Issue persists on all browsers and I am using the WebSQL adapter, but think this would occur using any adapter

Net Trace: calls _changes API https://xxx.cloudant.com/sm_db/_changes?timeout=55000&style=all_docs&heartbeat=10000&since=3828-g1AAAAOreJy10cEOwUAQANClgm9wQMS5WXar2xN_ws7uSiPVJm2d-RPEQXwFf8Kf1NoWVw57mclsJvOyMxFCqB06Eg0liCRVMwljV60zEfI0zzAeuSJKNpLHuRurPNLddY6gVxTFKnRAV521fmtNKCHBmP445j8P-jrC9EPWLobEygOPcjvk7EXOv-TJkJRTDP7EDrl4kdvvYpuG9ITEIO38Mm7oiHY6aXVfsV3Dcl_RJZMW2UPJXqsFnw3LAsKFBIvsrWTvFXs0rM-AQuBbZB8l-77twLCEEMYU_nHa6gm7PSkz

Response :

{"results":[
{"seq":"553-g1AAAAL0eJyl0ksOgjAQBuBGTdBTaIxrUoqUspKbaKctQYI14bHWm-hN9CZ6E2xloexQNjPJZPJN8mdyhNA0HUu0kiCOhYolEFcdSpHyoiox9lyRH2vJdeVqVeVme8QRzJumydIxRwczcCjFlHiRRLNaS5XstZK_ibAwFTYd1OeMcOYPQGOLbjsojrwkomQAurPoqYPCGtMwCP5H9cRUdDbNuJevXEXIEhYOha8tfPvAUcAEUG8ofG_hh4WdNxxwUMTm24v65-azvWnjBzNctr_i-4wp3FPLXsF06yg","id":"bases_769","changes":[{"rev":"1-ab82650daaf2d984945754be29c429c8"}]},
{"seq":"16-g1AAAALxeJyl0EsOgjAQBuBGTNBT6MI1KUXaspKbaF8ECZSEx1pvojfRm-hNsMBC2SFsZpLJ5PuTPwUArGJLgp3kIi9UKDlyVFaKmBVVCaHriDSvJdOVo1WVmu8FA3zTNE0SWwxk5mBjDDFyAwnWtZYqOmsl_xP51kx-GKAeo4hRbwYatuhxgMLAjQKMZqCnFr0MUL6HmPj-dFQvzQRXs4x7--lVEBpRMhe-9_DjCwc-FRy7c-FnD79a2O5gn3GF2n5HUVMy331mV_-6y0SCCMLISCr5ADvj62w","id":"users_152619","changes":[{"rev":"3-0b3e3ad87856f6c443881fa3172cdbf2"}]}
],
"last_seq":"16-g1AAAALxeJyl0EsOgjAQBuBGTNBT6MI1KUXaspKbaF8ECZSEx1pvojfRm-hNsMBC2SFsZpLJ5PuTPwUArGJLgp3kIi9UKDlyVFaKmBVVCaHriDSvJdOVo1WVmu8FA3zTNE0SWwxk5mBjDDFyAwnWtZYqOmsl_xP51kx-GKAeo4hRbwYatuhxgMLAjQKMZqCnFr0MUL6HmPj-dFQvzQRXs4x7--lVEBpRMhe-9_DjCwc-FRy7c-FnD79a2O5gn3GF2n5HUVMy331mV_-6y0SCCMLISCr5ADvj62w","pending":0}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

git clone https://github.com/pouchdb/pouchdb.git
cd pouchdb
npm install

Then grab packages/pouchdb/dist/pouchdb.js; that’s the latest build. 😃