-
-
Notifications
You must be signed in to change notification settings - Fork 94
Are lean
queries supported?
#140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there any input on this please? cc @nodkz ? |
@SnidelyWhiplash sorry for late response. I was terribly busy with preparation for 2 conference talks and 2 active projects. Let think what we can do with
Thanks! Hope this problem is still actual for you. |
Hi @nodkz. This reply is incredibly delayed, sorry for that! We moved on to other issues, but now we're revisiting this. I'll try to open a PR with a test, but I was curious if perhaps there has already been any movement on this feature? If my understanding is correct, using Thanks! references: |
@SnidelyWhiplash I found a workaround. Albeit not perfect as it isn't a query option but instead specified during composition.
Check out this file for more context about how it works @nodkz a perfect solution IMO would be to add lean as a resolver argument. |
…ean`, `findByOneLean` which returns data from DB without instantiating a full Mongoose documents. It's faster in several times but doesn't support getters & virtuals fields. See https://mongoosejs.com/docs/tutorials/lean.html#using-lean Related #140
…ean`, `findByOneLean` which returns data from DB without instantiating a full Mongoose documents. It's faster in several times but doesn't support getters & virtuals fields. See https://mongoosejs.com/docs/tutorials/lean.html#using-lean Related #140
New lean-resolvers were added in |
More details here: #263 (comment) |
…ddition to basic resolvers related: #263 (comment) closes #266 related #140
…ddition to basic resolvers related: #263 (comment) closes #266 related #140
As I understand it, queries return fully instantiated Mongoose models by default. But you can override this if you just need the raw data, and don't plan on calling any instance methods, etc by using the
lean
option...In my (limited) testing, it doesn't seem like that is supported in resolvers here..? I've tried both
Model.find({ query }, null, { lean: true })
andModel.find({ query }).lean()
but it seems to prevent me from querying relational data. (It's been a while since I tested, I'm only just now circling back to this. I can provide fuller examples/errors if needed).In the past, on REST projects, I've noticed significant performance impacts when querying for multiple documents without
lean
, and in my current GraphQL project I'm thinking this may also be the reason for slow query times.Thanks for any insight!
The text was updated successfully, but these errors were encountered: