prisma1 icon indicating copy to clipboard operation
prisma1 copied to clipboard

$WHERE OR / NOT available in mongodb?

Open Mercurial opened this issue 6 years ago • 10 comments
trafficstars

I can't seem to use WHERE OR , WHERE NOT in MongoDB

image image

Am I doing something wrong?

Mercurial avatar Jan 21 '19 09:01 Mercurial

No, these were disabled in the Mongo connector in order to enable filters on relations. We might bring them back in the future, but for now we valued a quicker implementation of relational filters higher than OR, NOT.

I hope you can work around the lack of these for now?

do4gr avatar Jan 22 '19 15:01 do4gr

Thanks for the answer @do4gr

Mercurial avatar Jan 24 '19 22:01 Mercurial

Hi @do4gr in practice how should be filtering ? Or should we wait until more work has been done?

otrebu avatar Feb 06 '19 15:02 otrebu

Curious how you accomplish this now with something like this before using Postgres?

query SEARCH_SNAKES_QUERY($searchTerm: String!) {
    snakes(
      where: {
        OR: [
          { name_contains: $searchTerm }
          { description_contains: $searchTerm }
        ]
      }
    ) {
      id
      image
      name
    }
  }

Is there some other way we are supposed to do this now in the Mongo connector world?

btotharye avatar Mar 15 '19 13:03 btotharye

The only option I could think of for the moment is to create two separate subscriptions for this.

do4gr avatar Mar 15 '19 14:03 do4gr

No, these were disabled in the Mongo connector in order to enable filters on relations. We might bring them back in the future, but for now we valued a quicker implementation of relational filters higher than OR, NOT.

I hope you can work around the lack of these for now?

Hi @do4gr , any update about this topic?

jhagu avatar Mar 17 '20 20:03 jhagu

No, sorry we are currently focusing on the upcoming Prisma 2 release.

do4gr avatar Mar 18 '20 08:03 do4gr

No, sorry we are currently focusing on the upcoming Prisma 2 release.

Thanks for your answer!

jhagu avatar Mar 18 '20 18:03 jhagu

Please provide any work around for OR in MongoDB, its one of the major query parts. Otherwise we have 4 products in prisma and have to move to mongod connector.

sohailhaider avatar Jul 08 '20 10:07 sohailhaider

It's a shame this is not mentioned in the docs: https://v1.prisma.io/docs/1.34/prisma-client/basic-data-access/reading-data-JAVASCRIPT-rsc2/#basic-filters-for-lists Just lost half a day debugging this :(

dimaip avatar Jul 15 '20 16:07 dimaip