apostrophe icon indicating copy to clipboard operation
apostrophe copied to clipboard

"and" filter method not working with joinByOne or joinByArray

Open FerX opened this issue 6 years ago • 0 comments

The filters and options not work.

    {
        name: "_best_product",
        withType: "product",
        type: "joinByOne",
        filters: {
            and: { score: { $gte: 5 } },
            projection: {
                title: 1,
                slug: 1,
                type: 1,
                tags: 1
            }
        }
    }

To Reproduce I created a git to run a test: https://github.com/FerX/apostrophe-test-and

Steps to reproduce the behavior:

  1. clone git
  2. npm install
  3. create user admin
  4. run project
  5. add many piece products with score from 1 to 10
  6. in the home page, open Page Settings
  7. tab info - best product - Browse
  8. you will see that it displays all the pieces and not filtered based on the AND rule entered in lib/modules/home-pages/index.js

Expected behavior list of products with score >=5

Describe the bug the and filter is not used to compose the mongodb filters

Version of Node.js v11.15.0

Server Operating System Linux Debian stable

FerX avatar Dec 12 '19 19:12 FerX