# Nested where function doesn't work with ".Params.categories"

**URL:** https://discourse.gohugo.io/t/nested-where-function-doesnt-work-with-params-categories/15806
**Category:** support
**Created:** [December 13, 2018, 5:47am UTC](https://discourse.gohugo.io/t/nested-where-function-doesnt-work-with-params-categories/15806 "2018-12-13T05:47:28Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)
#### Post date: [December 13, 2018, 6:17am UTC](https://discourse.gohugo.io/t/nested-where-function-doesnt-work-with-params-categories/15806/2 "2018-12-13T06:17:04Z")

</div>

Hi,

> [@nandehu0323](#):
>
> Does where function not support operators “in” and “not in”?

It does. From the docs: [collections.Where | Hugo](https://gohugo.io/functions/where/)

> **`in`**
> 
> `true` if a given field value is included in a matching value; a matching value must be an array or a slice

In your case, `"news"` is neither an array nor a slice. Also, the given field value here is `".Params.categories"`, which (I’m assuming) is an array.

What you probably want instead is

- the `intersect` function: [collections.Where | Hugo](https://gohugo.io/functions/where/#use-where-with-intersect)
- combined with `complement`: [collections.Complement | Hugo](https://gohugo.io/functions/complement/)

Something like (untested)

```auto
{{ $posts := (where .Pages "Section" "post" ) }}
{{ $news := (where (where .Pages "Section" "post" ) ".Params.categories" "intersect" (slice "news") ) }}

{{ $notnews := $posts | complement $news | first 3 }}

```

`slice "news"` in this case turns `"news"`, a string, to `["news"]`, an array containing `"news"`

Then you can `{{ range first 3 $notnews }}` .

---

_[View the full topic](https://discourse.gohugo.io/t/nested-where-function-doesnt-work-with-params-categories/15806)._
