Replies: 2 comments 11 replies
-
Hey @nexflo this could be due to many things but it's definitely something to do with your configuration. 5734ms is definitely not something that should happen with Payload. If you use Mongoose directly, you're not going through any Payload hooks, access control, or relationship population. So there's lots more that Payload has to do vs. Mongoose. If at any point you have a misconfigured hook, or access control, or slow query from a population / similar, things could slow down significantly. You should start by checking if you have any queries that are filtering on fields that you do not have indexed. For example, How many documents do you have in the collection that you're querying? Does the speed improve if you add I will convert this into a discussion so we can continue to help but I don't think this is related to Payload. If you can give us a reproduction and it does turn out to be something to do with Payload I would be happy to re-open the issue though. |
Beta Was this translation helpful? Give feedback.
-
Hey @jmikrut, I'm sort of agreeing this. I'm using version - |
Beta Was this translation helpful? Give feedback.
-
Link to reproduction
No response
Payload Version
3.62
Node Version
18.17.2
Next.js Version
latest
Describe the Bug
We have the following query:
const res = await payload.find({
collection: "testitems",
where: { and: [{ listId: { equals: listId } }, { isUsed: { equals: false } }] },
limit: 1,
});
Via payload api above:
01 find payload api 5734ms
If we use mongoose directly its fast as expected.
02 find mongoose 23ms
Quite critical I believe.
Reproduction Steps
Write same query in mongoose and payload find api
Adapters and Plugins
db-mongodb
Beta Was this translation helpful? Give feedback.
All reactions