-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[MongoDB] Performance issue in findMany() query execution with in #15983
Copy link
Copy link
Closed
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.topic: findMany()topic: intopic: mongodbtopic: performancetopic: performance/queries
Milestone
Description
Bug description
I have a nextJS project and I am using Prisma as an ORM for mongoDB.
I need to execute findMany for a collection having 1 million documents.
Performance change:
When I try to execute the same aggregation in mongoDB compass it takes less than 0.5 sec
while with prisma it takes around 20 sec to get the result.
How to reproduce
Create a collection with 1 million documents.
Search 5 document through id with the help of findMany()
It will take around 20 sec to execute the aggregation.
Expected behavior
It should return asked documents in (0.5 - 1 ) sec.
Prisma information
model collection_name {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String?
age Float?
url String?
}this.prismaClient.collection_name.findMany({
where: { id: { in: [id1, id2, id3] } }
})Environment & setup
- OS: macOS
- Database: MongoDB
- Node.js version: v16.17.1
Prisma Version
"prisma": "^3.12.0"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.topic: findMany()topic: intopic: mongodbtopic: performancetopic: performance/queries