With MongoDBAtlas I am trying to query products in my database which are greater than a certain price. Here is my query:
query findProducts{
product(price_gt: 2000)
{
id,
price
}
}
Here is the structure of the query:
product(query: ProductQueryInput): Product
Here is the relevant extract of my GraphQL schema:
input ProductQueryInput {
price_gt: String
}
When I run the code I get the error:
{
"data": null,
"errors": [
{
"message": "Unknown argument \"price_gt\" on field \"product\" of type \"Query\".",
"locations": [
{
"line": 33,
"column": 11
}
]
}
]
}
I am a beginner with mongoDB so may be missing something obvious, but given the query is structured like it is and price_gt is in the schema as a input, I would have assumed it would just work.