Unnecessarily saving revisions array to metadata
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
I've been developing a [FoundationDB adapter](https://github.com/keijokapp/foundationdb-pouchdb). FoundationDB has a hard limit on key and value lengths, so [`4204 respect revs_limit`](https://github.com/pouchdb/pouchdb/blob/14a566f2e7bb780c1af37fd468f419f029a0adc5/tests/integration/test.bulk_docs.js#L1007) brought out this issue.
It seems that `_revisions` passed into `bulkDocs` is used only to [create an initial revision and tree](https://github.com/pouchdb/pouchdb/blob/14a566f2e7bb780c1af37fd468f419f029a0adc5/packages/node_modules/pouchdb-adapter-utils/src/parseDoc.js#L120-L122) but is then [moved to document's metadata](https://github.com/pouchdb/pouchdb/blob/14a566f2e7bb780c1af37fd468f419f029a0adc5/packages/node_modules/pouchdb-adapter-utils/src/parseDoc.js#L152) and [saved to document store](https://github.com/pouchdb/pouchdb/blob/14a566f2e7bb780c1af37fd468f419f029a0adc5/packages/node_modules/pouchdb-adapter-leveldb-core/src/index.js#L686). The property doesn't seem to be used for anything else and removing that before returning from `parseDoc` doesn't break any tests. What's worse is that this array does not get reduced to `revs_limit` in a same way as revision tree does. So it's just there taking up space.
I'd be willing to make a PR but it seems there are also other reserved properties that are not used at all but still saved (eg. `deleted_conflicts`) and I'm not sure what the intentions are.
Contributor guide
Assessment
This issue has not been assessed yet.