Graphql: NOT filter is not working with tags #10766

Closed
opened 2025-12-29 21:35:43 +01:00 by adam · 4 comments
Owner

Originally created by @hikhvar on GitHub (Feb 12, 2025).

Deployment Type

NetBox On Premise, Docker Container

NetBox Version

v4.2.2

Python Version

3.10

Steps to Reproduce

  1. Create some devices
  2. Create a tag coredns
  3. Tag some devices with coredns but not all.
  4. Run this graphql query:
query notTaggedDevices {
  device_list(filters: {NOT:{tag:"coredns"}}) {
    id,
    name
  }
}

Expected Behavior

The query should return all devices not tagged with the coredns tag.

Observed Behavior

I get the same results as with the query

query taggedDevices {
  device_list(filters: {tag:"coredns"}) {
    id,
    name
  }
}
Originally created by @hikhvar on GitHub (Feb 12, 2025). ### Deployment Type NetBox On Premise, Docker Container ### NetBox Version v4.2.2 ### Python Version 3.10 ### Steps to Reproduce 1. Create some devices 2. Create a tag `coredns` 3. Tag some devices with `coredns` but not all. 4. Run this graphql query: ``` query notTaggedDevices { device_list(filters: {NOT:{tag:"coredns"}}) { id, name } } ``` ### Expected Behavior The query should return all devices not tagged with the `coredns` tag. ### Observed Behavior I get the same results as with the query ``` query taggedDevices { device_list(filters: {tag:"coredns"}) { id, name } } ```
adam added the type: bugtopic: GraphQLseverity: low labels 2025-12-29 21:35:43 +01:00
adam closed this issue 2025-12-29 21:35:43 +01:00
Author
Owner

@arthanson commented on GitHub (Feb 12, 2025):

blocked by #16024

@arthanson commented on GitHub (Feb 12, 2025): blocked by #16024
Author
Owner

@hikhvar commented on GitHub (Feb 14, 2025):

After reading up on #18618 and https://github.com/netbox-community/netbox/discussions/18431, hopefully this bug will be fixed if #18618 is merged.

@hikhvar commented on GitHub (Feb 14, 2025): After reading up on #18618 and https://github.com/netbox-community/netbox/discussions/18431, hopefully this bug will be fixed if #18618 is merged.
Author
Owner

@hikhvar commented on GitHub (Feb 19, 2025):

I tested my query against the branch 7598-graphql-custom-fields with slight modifications to adapt to the new filters.
I will post my feedback here, as there is no open PR for that branch yet.

This query produces the expected result on the branch:

query notTaggedDevices {
  device_list(filters: {NOT:{tags:{slug:{exact:"coredns"}}}}) {
    id,
    name
  }
}
@hikhvar commented on GitHub (Feb 19, 2025): I tested my query against the branch `7598-graphql-custom-fields` with slight modifications to adapt to the new filters. I will post my feedback here, as there is no open PR for that branch yet. This query produces the expected result on the branch: ``` query notTaggedDevices { device_list(filters: {NOT:{tags:{slug:{exact:"coredns"}}}}) { id, name } } ```
Author
Owner

@jeremystretch commented on GitHub (Apr 28, 2025):

Confirmed that the query above works as expected on v4.3.0-beta2.

@jeremystretch commented on GitHub (Apr 28, 2025): Confirmed that the query above works as expected on v4.3.0-beta2.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10766