Upgrading to 9.0.0 breaks indexes for fields which contain an underscore when using indexeddb adapter

未关闭
#8,975 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
databases

调研方向

首先使用 pouchdb-adapter-indexeddb 8.0.1 和 9.0.0 运行列出的复现步骤,然后检查包含下划线的索引字段是如何存储和查询的。将升级路径与新创建的索引进行比较;当现有索引无需删除并重新创建即可继续返回更新后的文档时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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:
image
Example after:
image

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
主要语言
JavaScript
星标
17.6k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/pouchdb 的其他 Issue

查看 apache/pouchdb 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。