P
Prisma•5mo ago
Nicklas Smit

Nested queries with mongodb not working.

Hi guys, I have run into a roadblock in my project where I need to fetch some data via my search operation. I have the following relations setup: Product - Variants: 1-many Variant - InventoryItems: 1-many in searching InventoryItems I want to query the title of the nested variants - product. It seems that this kind of nested query is way too complicated for prisma or my indexes/relations are set up incorrectly. here is an example of a working query...
const TestRequest = await prisma.inventoryItem.findFirst({
where: {
variant: {
title: "45",
},
},
include: {
variant: true,
},
take: 10,
})
console.log("TestRequest", TestRequest)
const TestRequest = await prisma.inventoryItem.findFirst({
where: {
variant: {
title: "45",
},
},
include: {
variant: true,
},
take: 10,
})
console.log("TestRequest", TestRequest)
But if we switch this to a findMany .. we get a timeout!
This request could not be understood by the server: {"type":"UnknownJsonError","body":{"code":"P6004","message":"The Query did not produce a result within the maximum allowed execution time of 10 seconds."}} (The request id was: 89a58c1a787a929a)
This request could not be understood by the server: {"type":"UnknownJsonError","body":{"code":"P6004","message":"The Query did not produce a result within the maximum allowed execution time of 10 seconds."}} (The request id was: 89a58c1a787a929a)
Nesting further into the variants connected product modal we are also met with nothing but a timeout. for context I have 9769 InventoryItems ,1590 products and 14989 Variants. I have also attached images. any help would be much appreciated.
No description
No description
No description
No description
6 Replies
Nicklas Smit
Nicklas SmitOP•5mo ago
Bump!?? @🔨 Moderator
Olyno
Olyno•5mo ago
Hi :vmathi: You already bumped your message a few minutes ago, it is not necessary to ping mods for that 🙂
Nurul
Nurul•5mo ago
Hey Nicklas, If I understand correctly, you get a timeout query with this kind of findMany query, right?
const TestRequest = await prisma.inventoryItem.findMany({
where: {
variant: {
title: "45",
},
},
include: {
variant: true,
},
take: 10,
})
const TestRequest = await prisma.inventoryItem.findMany({
where: {
variant: {
title: "45",
},
},
include: {
variant: true,
},
take: 10,
})
Does this happen even if you are just fetching 10 records?
Nicklas Smit
Nicklas SmitOP•5mo ago
Hey Nurul, yes it does. Even Take: 2 is timing out. (The request id was: 8a33a7d42b9c92e5) (The request id was: 8a33abc59dd492fa) Is this informative ?
Nurul
Nurul•5mo ago
Our team has identified the cause of this timeout. This happens due to a DNS resolution issue in MongoDB Rust Driver. Our team is i touch with MongoDB team to find a resolution for this. I will keep you updated with progress fron our end and will share a timeline for the resolution as soon as I have it
Nicklas Smit
Nicklas SmitOP•5mo ago
Thank you!
Want results from more Discord servers?
Add your server