Filters to check if array empty or equals to some value

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

ctx.query.filters = {

  {

      ...(house.address &&

        house.address.state && {

          $or: [

            {

              state: {

                $containsi: [house.address.state],

              },

            },

            {

              state: { $eq: [] },

            },

          ],

        }),

    },

    {

      ...(house.address &&

        house.address.zip_code && {

          $or: [

            { zip_code: { $eq: [] } },

            { zip_code: { $containsi: [house.address.zip_code] } }

          ],

        }),

    },
    {

      ...(house.bedrooms && {

        $or: [

          {

            bedrooms: house.bedrooms.toString(),

          },

          {

            bedrooms: null,

          },

        ],

      }),

    },

    {

      ...(house.bathrooms && {

        $or: [

          {

            bathrooms: house.bathrooms.toString(),

          },

          {

            bathrooms: null,

          },

        ],

      }),

    },

    {

      ...(house.lead_stage && {

        $or: [

          {

            lead_stage: {

              $containsi: [house.lead_stage],

            },

          },

          {

            lead_stage:  { $eq: [] },

          },

        ],

      }),

    },

  ],

};

return strapi.entityService.findMany(“api::buy-box.buy-box”, {

  ...ctx.query,

});

in or filters when I just add the first line ({ zip_code: { $eq: [] } }) it gives me a response, but when put both conditions in it gives me an empty array. it does not make sense when one condition is true in or it should give truly for that filter.
my strapi version is 4.6.2 and I use Postgres db
Thank you for your help.