pouchdb-adapter-asyncstorage is outdated. Is project abandoned, what to expect?
What doesn't work (on top of already stated almost useless attachments):
-
queries + replication .query: once db with updated docs replicated from couchdb server to RN .query starts to return only the last updated doc (while others are presented in localDB as well) .find: after any(!) replication stops to return any results at all The most critical issue. The only available workaround is to get allDocs and then apply js filtering, which is VERY costy in case of lots of relatively heavy docs in DB.
-
keys filter in allDocs isn't respected
-
doc_ids in replicate isn't respected (could be resolved by upgrading underlying PDB components to 7.0.0)
Since pouchdb-adapter-asyncstorage is core and the only specific part of pouchdb-react-native itself, that's the question: is there any plans to update pouchdb-adapter-asyncstorage in order to support recent changes in couchdb replication?
changes or keys part of pouchdb-adapter-asyncstorage can be suspected but for sure maintainer knows better)
Understanding of possible project future for all of us is quite critical, please let us know what to expect. And thank you.
please try npm install pouchdb-react-native@next --save
if all ok, I'll update to version 7.0
Great news! Thank you. At first glance importing .find plugin brings errors while accessing indexes. Let me try it with .query - I have to revert to old code which used it.
Seems that replication is broken now. My code, which worked fine with old PDBRN (or bundle of old pouchdb-adapter-asyncstorage + PDB 7.0 core+plugins)
localDB.replicate.from(remoteDB)
now replicates no docs from same remote db
{ ok: true,
docs_read: 0,
docs_written: 0,
doc_write_failures: 0,
errors: [],
status: 'complete' }
I can pull one doc but then saving it (with rev removed, off cause) gets strange result:
' !!! PDB _saveDoc ERR localDB.put: ===== ', []
From code:
return localDB.put(doc)
.then((result)=> {
if (result.ok) {
return resolve('doc_saved')
} else {
console.log(' !!! PDB _saveDoc ERR localDB.put: ===== ', result)
return reject(result.status)
}
})
Thanks @greenais for the comments which helped me at least not to keep hitting my head in the wall. were you able finally to get a stable mix of working PouchDB especially with Find plugin? Because after investing time and effort in PouchDB I am considering abandoning it to Realm
@sheva007 No, .find doesn't work yet for me. In my current project I use "old" pouchdb-adapter-asyncstorage in conjunction with the most recent (7.0) PDB plugins:
import PouchDB from 'pouchdb-core';
PouchDB
.plugin(require('pouchdb-adapter-asyncstorage').default)
.plugin(require('pouchdb-adapter-http'))
.plugin(require('pouchdb-replication'))
.plugin(require('pouchdb-authentication'))
const localDB = new PouchDB(localDBname, {adapter: 'asyncstorage'});
For now I do my .query stuff in js by filters - after getting all_docs. Not the most efficient solution, but it lets move further until issues will be fixed (we all hope). I really like CounchDB approach on server side - the key part is replication, sure, so I didn't consider Realm as an option as I see no point in reinventing weel with authentication/replication/version control etc. But if you don't need it - why not?
Thanks for the reply, were able to use any kind of filtering in Pouch DB? Getting all docs then filtering in code is hitting the performance hard
Shure it does. .query works just fine until you replicate some changed docs from CouchDB - then it returns the last changed doc only.
Thanks for that, I will try to work on it today. The thing which bothers me that "find" used to work just fine but I do not remember which versions, I usually feel uncomfortable using old versions of libs
.find works as well fine until replication, afer - zero results
Any updates from mantainer, perhaps?
Interestingly, taking out pouchdb-adapter-asyncstorage and instead using pouchdb-adapter-react-native-sqlite results in the exact same problem in the OP. So it's not a pouchdb-adapter-asyncstorage problem, but something to do with one of the other core components?
That's right, the issue is around the fact that PDB is designed to work in modern browsers environments (with V8 mostly) while RN uses JS Core - where several core functions (btoa i.e.) are implemented differently. That's why PDB guys just don't try to bother with RN issues - "it wasn't designed for RN, sorry". It means that PDBRN support involves quite deep substitutions/shims to new versions of PDB, which is much harder than just drop-in new PDB