-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
.lean and .populate together #1260
Comments
Not right now but that makes good sense. If the query was lean the I'm rewriting the populate code right now so I'll add this to the TODO list. On Tuesday, December 25, 2012, Oleg Slobodskoi wrote:
Aaron |
Сurrently .populate has no effect at all |
eww. ok thanks. |
👍 I ran in to this today as well, adding .lean() cancels out .populate(). |
+1 |
fixed here (populate-wip branch) 8f7dda9 |
Thanks for fixing this one! What release will the fix be in, 3.5.5? |
3.6 |
Is it really fixed? I just got the master, installed its dependencies, and lean() and populate() don't seem to work together: I see { "_id": "......", "_bsontype": "ObjectId" } and not the field I wanted. |
@yarrouye all the tests are passing. can you open a new ticket with steps to reproduce? |
I know that this issue has been solved, however, I'm not quite sure why it's intuitive to use .lean() before .populate(). It makes sense for me to .populate() before.lean() so that the document get's populated and then .toObject()ed. Can anyone please explain so that I'm sure that I haven't misunderstood the purpose of .lean()? |
lean skips all the overhead of creating mongoose documents from the objects returned by the driver and just returns them as is. performance win. |
But didn't .populate() used to work with .lean() if populate was called before lean? |
in < 3.6, if lean was used, population wouldn't occur. |
Oh, so the order of lean and populate calls didn't matter? I didn't realize that. |
populate() just sets an option, same as lean() |
How to use lean and populate together ? |
@mallikarjunece If you set |
Is there any way or any plans to make them usable together?
Are there any issues which make it difficult to implement?
P.S. I am now using .lean in the most places, because I spent a huge amount of cpu time on wrapping in mongoose documents.
The text was updated successfully, but these errors were encountered: