# Filter option "$where"

**URL:** <https://discourse.getcockpit.com/t/filter-option-where/1994>\
**Category:** Support\
**Created:** [July 6, 2021, 8:48pm UTC](https://discourse.getcockpit.com/t/filter-option-where/1994 "2021-07-06T20:48:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abernh](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/abernh/32/859_2.png) [@abernh](https://discourse.getcockpit.com/u/abernh)\
**Post date:** [July 6, 2021, 8:48pm UTC](https://discourse.getcockpit.com/t/filter-option-where/1994/1 "2021-07-06T20:48:42Z")

</div>

I just wanted to drop this here for others to find … and future me.

This is the new `$where` filter option, introduced in [33e7199](https://github.com/agentejo/cockpit/commit/33e7199575631ba1f74cba6b16b10c820bec59af) and that’s the official example on how to use it

```auto
cockpit('collections')->find('posts', [
    'filter' => [
        '$where' => function($doc) {
            return $doc['published'] && $doc['title'] != 'Lorem Ipsum';
        }
    ]
]);

```

---

<div class="post-metadata">

**Author:** ![abernh](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/abernh/32/859_2.png) [@abernh](https://discourse.getcockpit.com/u/abernh)\
**Post date:** [July 6, 2021, 8:50pm UTC](https://discourse.getcockpit.com/t/filter-option-where/1994/2 "2021-07-06T20:50:22Z")

</div>

There is nothing more for me to add here. Just needed a reply to mark this “solved”.
