# Filter OUT nodes with edges

**URL:** <https://discuss.dgraph.io/t/filter-out-nodes-with-edges/11122>\
**Category:** GraphQL\
**Created:** [October 26, 2020, 11:21am UTC](https://discuss.dgraph.io/t/filter-out-nodes-with-edges/11122 "2020-10-26T11:21:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damienburke](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@damienburke](https://discuss.dgraph.io/u/damienburke)\
**Post date:** [October 26, 2020, 11:21am UTC](https://discuss.dgraph.io/t/filter-out-nodes-with-edges/11122/1 "2020-10-26T11:21:12Z")

</div>

Hey,

For this query i think it best i explain by way of example, and then perhaps I can modify the title/desc based on feedback…

Data:

```auto
{
  set {  
    _:a1 <customer> "10040" .
    _:e1 <email> "30040@gmail.com" .
    _:u1 <browser> "20040" .
    
    _:o1 <usercode> "usercode_f" .
    _:o2 <usercode> "usercode_g" .
    _:o3 <usercode> "usercode_h" .
    _:o4 <usercode> "usercode_i" .
    
    _:o1 <authenticate_as> _:a1 .
    _:o1 <browsed_on> _:u1 .
    _:a1 <subscribes_as> _:e1 .

    _:o2 <referred_with> _:e1 .
    _:o2 <browsed_on> _:u1 .
    
    _:o3 <browsed_on> _:u1 .
    _:o4 <browsed_on> _:u1 .
  }
}

```

WIP Query:

```auto
{
    userocode_by_browser (func:eq(browser, "20040")) {
    name:browser
    ~browsed_on {
      name:usercode
        authenticate_as {
          name:customer
        }
        referred_with {
          name:email
        }
      }
  }
}

```

Result: ![Screenshot 2020-10-26 at 11.21.45](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/e/e13e11949157afc4183863015c7bbd976446f5ee.png)

Desired Result:  
Omit usercode\_f and usercode\_g because they have outgoing edges. I only want h and i (as they have no outgoing edges)

Thanks

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [October 26, 2020, 12:11pm UTC](https://discuss.dgraph.io/t/filter-out-nodes-with-edges/11122/2 "2020-10-26T12:11:01Z")

</div>

Hi @damienburke,

You may use some query like this,

```auto
{
    userocode_by_browser (func:has(browser)) {
    name:browser
    ~browsed_on @filter(NOT(has(referred_with) OR has(authenticate_as))) {
      name:usercode
      // anything else you want to print
      }
  }
}

```

The query makes use of Connecting Filters. You may read more about it [here](https://dgraph.io/docs/query-language/connecting-filters/).

---

<div class="post-metadata">

**Author:** ![damienburke](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@damienburke](https://discuss.dgraph.io/u/damienburke)\
**Post date:** [October 26, 2020, 2:31pm UTC](https://discuss.dgraph.io/t/filter-out-nodes-with-edges/11122/3 "2020-10-26T14:31:31Z")

</div>

awesome, thanks @rajas
