Skip to content

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

@smesgr9000

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions