methods/set-brand-ids.js

  1. import commonFilter from './../lib/common-filter'
  2. // handle filter by brand IDs
  3. export default (self, brandIds) => commonFilter(self, 'brands', '_id', brandIds)
  4. /**
  5. * @method
  6. * @name EcomSearch#setBrandIds
  7. * @description Defines list of brand IDs to match on next search request,
  8. * filtering product results by brand.
  9. *
  10. * @param {array<string>|null} brandIds - List of brand ObjectIDs (`_id`)
  11. * @returns {self}
  12. *
  13. * @example
  14. // Set filter by brand ID and run search request
  15. search.setBrandIds([ '5c703b35c626be23430d5030' ]).fetch()
  16. * @example
  17. // Remove filter by brand ID
  18. search.setBrandIds(null)
  19. */