Skip to main content

Strict Equal Filter

Exact-match filtering on product fields: each active filter key/value pair is added to the MongoDB product selector as-is.

Included in All Preset

Registered automatically by registerAllPlugins().

If you use the base preset or register plugins individually:

import { pluginRegistry } from '@unchainedshop/core';
import { StrictEqualFilterPlugin } from '@unchainedshop/plugins/filters/strict-equal';

pluginRegistry.register(StrictEqualFilterPlugin);

Adapter Details​

PropertyValue
Keyshop.unchained.filters.strict-equal
Order Index0 (runs first)
Sourcefilters/strict-equal

Behavior​

transformProductSelector() merges the filter key/value into the product selector:

// { key: "brand", value: "nike" } → { brand: "nike" }
// { key: "inStock", value: undefined } → { inStock: { $exists: true } }

The filter key maps directly to a product document field (dot notation works for nested fields, e.g. meta.material). Matching is exact and case-sensitive; there are no ranges or partial matches — use Local Search for text queries or a custom adapter for anything else.

Because it runs at orderIndex: 0, subsequent filter adapters receive its transformed selector.

Usage​

Create a filter whose key matches a product field:

mutation CreateBrandFilter {
createFilter(filter: {
key: "brand"
type: SINGLE_CHOICE
}) {
_id
}
}

mutation AddBrandOption {
createFilterOption(filterId: "...", option: "nike") {
_id
}
}

Query with it:

query FilteredProducts {
searchProducts(
filterQuery: [{ key: "brand", value: "nike" }]
) {
products {
_id
texts { title }
}
filteredProductsCount
}
}