# Filtering with neo4j-graphql.js appears to be broken

**URL:** https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123
**Category:** GraphQL & GRANDstack
**Created:** [September 28, 2020, 9:45pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123 "2020-09-28T21:45:28Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![tlester](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tlester/32/14096_2.png) [@tlester](https://community.neo4j.com/u/tlester)
#### Post date: [September 28, 2020, 9:45pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/1 "2020-09-28T21:45:28Z")

</div>

Hi all -

I'm trying to get some filtering working and it's failing... not matter what I add for the filters. Not sure what's going on. My automatic schema has generated all the appropriate filters, but it's not doing anything. It always returns all users (in my use case).

```auto
query GetUser {
  User(filter: {username_contains: "tommo"}) {
    id
    firstName
    lastName
    email
    username
    avatar
    displayName
    prefix
    suffix
    phone
    birthday {
      formatted
    }
    tagline
    bio
    homepage
    city {
      name
    }
    state {
      name
    }
  }
}

```

And just for clarification sake... no... not all users have "tommo" in the name ;-) What's going wrong?

---

<div class="post-metadata">

### Author: ![jonathan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jonathan/32/21897_2.png) [@jonathan](https://community.neo4j.com/u/jonathan)
#### Post date: [November 19, 2020, 3:17am UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/2 "2020-11-19T03:17:58Z")

</div>

@ [tlester](https://community.neo4j.com/u/tlester) did you ever solve this issue? I seem to be having the same problem. filter: is ignoring all filter rules entirely and just returns entire result sets.

---

<div class="post-metadata">

### Author: ![tlester](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tlester/32/14096_2.png) [@tlester](https://community.neo4j.com/u/tlester)
#### Post date: [November 20, 2020, 2:41pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/3 "2020-11-20T14:41:11Z")

</div>

No... unfortunately, I had to bail on Neo4j for this reason. I'm now using Slash Graphql (the Dgraph SaaS offering for their Graph DB).

---

<div class="post-metadata">

### Author: ![jonathan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jonathan/32/21897_2.png) [@jonathan](https://community.neo4j.com/u/jonathan)
#### Post date: [November 20, 2020, 3:01pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/4 "2020-11-20T15:01:20Z")

</div>

i mean filtering is a pretty big deal, i can't believe this doesn't work.

---

<div class="post-metadata">

### Author: ![tlester](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tlester/32/14096_2.png) [@tlester](https://community.neo4j.com/u/tlester)
#### Post date: [November 20, 2020, 3:29pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/5 "2020-11-20T15:29:33Z")

</div>

Agreed. It's a critical cornerstone for my project

---

<div class="post-metadata">

### Author: ![jonathan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jonathan/32/21897_2.png) [@jonathan](https://community.neo4j.com/u/jonathan)
#### Post date: [November 20, 2020, 4:10pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/6 "2020-11-20T16:10:32Z")

</div>

what libraries are you using in your project in conjunction with Dgraph/Slash. what are you using to view your graph database is there a program similar to neo4j desktop?

did you have to change much in your project to migrate to the new database?

---

<div class="post-metadata">

### Author: ![PaulContremoulin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/paulcontremoulin/32/15218_2.png) [@PaulContremoulin](https://community.neo4j.com/u/PaulContremoulin)
#### Post date: [December 7, 2020, 8:00pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/7 "2020-12-07T20:00:58Z")

</div>

I'm facing to the same issue.  
Bug related on GitHub : [[BUG] Filtering in generated queries get erros · Issue #273 · neo4j-graphql/neo4j-graphql-js · GitHub](https://github.com/neo4j-graphql/neo4j-graphql-js/issues/273)

Seems to be a problem of peer dependencies.

---

<div class="post-metadata">

### Author: ![jonathan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jonathan/32/21897_2.png) [@jonathan](https://community.neo4j.com/u/jonathan)
#### Post date: [December 8, 2020, 12:57am UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/8 "2020-12-08T00:57:42Z")

</div>

@PaulContremoulin removing the "graphql" dependency fixed this issue for me. here is my package.json:

```auto
   "dependencies": {
    "apollo-server": "^2.19.0",
    "apollo-server-express": "^2.19.0",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "neo4j-driver": "^4.2.0-alpha01",
    "neo4j-graphql-js": "^2.17.1"
  },

```

and my index.js (note: im using firebase functions to serve the graphql endpoint and apollo studio for graph versioning and additional documentation)

edit: not sure why i have express in there twice, i'll take a look at that in a second.

```auto
const functions = require("firebase-functions")
const express = require("express")
const { makeAugmentedSchema } = require("neo4j-graphql-js")
const { ApolloServer } = require("apollo-server-express")
const neo4j = require("neo4j-driver")
const fs = require("fs")
const dotenv = require("dotenv")
const path = require("path")

dotenv.config()

const { NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD, PORT, APOLLO_KEY } = process.env

// Load GraphQL type definitions from schema.graphql file
const typeDefs = fs
  .readFileSync(path.join(__dirname, "schema.graphql"))
  .toString("utf-8")

const schema = makeAugmentedSchema({
  typeDefs,
})

const loggingConfig = { logging: neo4j.logging.console("debug") }

// Create Neo4j driver instance
const driver = neo4j.driver(
  NEO4J_URI,
  neo4j.auth.basic(NEO4J_USER, NEO4J_PASSWORD),
  loggingConfig,
)

const server = new ApolloServer({
  context: { driver },
  schema,
  introspection: true,
  playground: true,
  engine: {
    reportSchema: true,
    graphVariant: "development",
  },
})

const app = express()

server.applyMiddleware({ app, path: "/", cors: true }) //

exports.api = functions.https.onRequest(app)

```

i hope this helps someone.

---

<div class="post-metadata">

### Author: ![PaulContremoulin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/paulcontremoulin/32/15218_2.png) [@PaulContremoulin](https://community.neo4j.com/u/PaulContremoulin)
#### Post date: [December 15, 2020, 6:42pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/9 "2020-12-15T18:42:02Z")

</div>

Thanks @jonathan, `"apollo-server": "^2.14.2"` and `"neo4j-graphql-js": "^2.14.2"` fixed the issue for me. (without `graphql` dependency)

---

<div class="post-metadata">

### Author: ![jonathan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jonathan/32/21897_2.png) [@jonathan](https://community.neo4j.com/u/jonathan)
#### Post date: [December 15, 2020, 8:53pm UTC](https://community.neo4j.com/t/filtering-with-neo4j-graphql-js-appears-to-be-broken/26123/10 "2020-12-15T20:53:57Z")

</div>

@PaulContremoulin I'm happy to hear you got it working.

note: I'd accidentally included both "apollo-server": "^2.19.0", and "apollo-server-express": "^2.19.0", in my package.json where one OR the other but not both should be included. that was a typo.
