question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filter conditions help needed

See original GitHub issue

I’m using prisma2 for some weeks now, but i’m often stuck because of lack of documentation on some specifics points. I’m trying to do a simple query like WHERE value > 1 I can’t find any examples. In prisma1 it’s something with <fieldnams>_gt for greater than as explained here : https://github.com/prisma/prisma/issues/1890

That should look like this :

t.list.field('blocks_others', {
  type: 'Block',
  args: { 
    owner_address_exclude: stringArg({ nullable: true }),        
    value: intArg({ nullable: true }),        
  },
  resolve: (parent, { owner_address_exclude, value }, context) => {
    return context.prisma.block.findMany({
      where: { 
        NOT : {
          owner_address : owner_address_exclude
        },
        resale_price_gt : value
      },
      orderBy: { id: 'asc' },
    })
  },
})

And I get :

Unknown arg `resale_price_gt` in where.resale_price_gt for type BlockWhereInput. Did you mean resale_price`? Available args: ...

Thanks for helping Best

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
mhwelandercommented, Apr 30, 2020
2reactions
pantharshit00commented, May 11, 2020

This is expected. token is not a unique property, there is always a chance the the when you query by token it will return more than one record.

So will need to use findMany here findOne is meant to query one record identified by a unique identifier. Or you can make the token property unique but that doesn’t make much sense in this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter by using advanced criteria - Microsoft Support
If the data you want to filter requires complex criteria (such as Type = "Produce" OR Salesperson = "Davolio"), you can use the...
Read more >
Excel FILTER function with formula examples - Ablebits
See how to filter in Excel dynamically with formulas. Examples to filter duplicates, cells containing certain text, with multiple criteria, ...
Read more >
Advanced Filter Examples in Google Sheets - Ben Collins
How to use an advanced filter with an OR condition in Google Sheets, so you can filter multiple conditions quickly and easily.
Read more >
Adding Conditions to Filters - FICO Help
Adding Conditions to Filters · Click the Add additional filter conditions link and select the condition type. · (Optional) Click the Add icon...
Read more >
Using the AND, OR, and NOT functions - Google Ads Editor Help
The AND(...) OR(...) and NOT(...) functions allow greater control in how multiple filter conditions are combined to target very specific items being ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found