Skip to content

pouchdb-find exception when searching with index for not existing field #9183

Description

@smesgr9000

Issue

pouchdb-find creates an nullpointer exception:

TypeError: can't convert null to object
    objectCollate index.es.js:293
    collate index.es.js:42
    filterInclusiveStart index-browser.es.js:582
    find$1 index-browser.es.js:1404
    find index-browser.es.js:1501
    resolveToCallback index-browser.es.js:145

when search is done using an index. E.g.:

{
  "_id": "_design/700ae9eb4c3ddffe7f46e8b3140ee324aed53c0c",
  "_rev": "1-541457106de091fb5e9b2432e23e6112",
  "language": "query",
  "views": {
    "name-json-index": {
      "map": {
        "fields": {
          "name": "asc"
        },
        "partial_filter_selector": {}
      },
      "reduce": "_count",
      "options": {
        "def": {
          "fields": [
            "name"
          ]
        }
      }
    }
  }
}

and at least one(?) document doesn't have this field.

filterInclusiveStart tries to find keys getKeyFromDoc but doesn't have one. But this is not checked.

Info

  • Environment: Browser
  • Platform: tested with FF & Chrome
  • Adapter: indexeddb
  • Server: PouchDB 9.0.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions