Pouchdb: Nested $or not working in pouchdb-find

Created on 18 Feb 2020  路  4Comments  路  Source: pouchdb/pouchdb

{
  "$and": [
    {
      "$or": [
        {
          "female": {
            "$size": 0
          }
        },
        {
          "female": {
            "$exists": false
          }
        }
      ]
    },
    {
      "$or": [
        {
          "male": {
            "$size": 0
          }
        },
        {
          "male": {
            "$exists": false
          }
        }
      ]
    }
  ]
}

But result is

```
{
id: '00577033-4ba8-49f2-9de8-e8c5a1f52c75',
female: [ '030026c4-1284-4c70-8cc3-61f05027f77c' ],
male: [],
}

All 4 comments

use massageSelector

console.log(
  JSON.stringify(
    massageSelector({
      $and: [
        {
          $or: [
            {
              female: {
                $size: 0,
              },
            },
            {
              female: {
                $exists: false,
              },
            },
          ],
        },
        {
          $or: [
            {
              male: {
                $size: 0,
              },
            },
            {
              male: {
                $exists: false,
              },
            },
          ],
        },
      ],
    })
  )
);

{"$or":[{"male":{"$size":0}},{"male":{"$exists":false}}]}

@nolanlawson @willholley

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikkokam picture mikkokam  路  6Comments

ohmoses picture ohmoses  路  4Comments

nolanlawson picture nolanlawson  路  6Comments

xub picture xub  路  4Comments

gr2m picture gr2m  路  5Comments