Skip to content

vinibgoulart/gpql-mongo-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpql-mongo-search

A POC to how to create a filter in a graphql query to search for generic values in mongodb

tags

Run Locally

Clone the project

  git clone https://github.com/vinibgoulart/gpql-mongo-search.git

Go to the project directory

  cd gpql-mongo-search

Install dependencies

  yarn

Copy envs

  yarn env

Run seeder

  yarn seed

Start the server

  yarn dev

After that you can open graphql playground in your browser

http://localhost:4000/graphql/playground

Testing

Some examples of queries to test the search

Return all products:

query {
  products {
    name
    description
    price
  }
}

Return a product filtering by name:

query {
  products(filters: {search: "Cell"}) {
    name
    description
    price
  }
}

Return a product filtering by description:

query {
  products(filters: {search: "Apple"}) {
    name
    description
    price
  }
}

About

🥡 Filtering a graphql query

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published