Upgrading to 9.0.0 breaks indexes for fields which contain an underscore when using indexeddb adapter
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
### Versions
We're using the following modules. These were in version 7.2.2 and we updated them to 9.0.0.
- pouchdb
- pouchdb-adapter-indexeddb
- pouchdb-browser
- pouchdb-find
- pouchdb-selector-core
The problem only appears to be with the version of **pouchdb-adapter-indexeddb** module. The versions of the other modules do not affect this. I've also tested upgrading everything to 9.0.0 except this adapter (which i kept to version 7.2.2 once and 8.0.1 the 2nd time i tested it), and the problem below didn't happen.
### Issue
After the update to version 9.0.0, every time a document is updated or created, it is not being returned to the search results of some indexes.
We have an index of 2 fields which contain an underscore (WGS_Latitude, WGS_Longitude) and it does not contain the new documents. If we drop and recreate the index after the update, the exact opposite will happen; the updated documents will be returned but not the old ones.
After inspecting indexeddb I saw that every underscore in every field which contained one, was replaced by "_c95_". The fields appeared normally when fetching docs with db.get().
Example before:
Example after:
### Workaround
If the indexeddb is deleted and replicated again from the remote db, everything appears to be working normally (might not an option for some cases).
### Info
- Environment: ReactJS and Capacitor
- Platform: Chrome, Android Capacitor App
- Adapter: indexeddb
- Server: pouchdb-server
### Reproduce
1. Create a new pouchdb using pouchdb-adapter-indexeddb 8.0.1 or 7.2.2 (other versions haven't been tested).
2. Create some documents with a field which contains an underscore
3. Create an index with that field
4. Upgrade to pouchdb-adapter-indexeddb 9.0.0
5. Update a doc and try to fetch it with the created index
Contributor guide
Assessment
This issue has not been assessed yet.