-
Notifications
You must be signed in to change notification settings - Fork 96
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 #169
Comments
@dottodot, it's possible that using Mongoose's populate depends on returning Mongoose documents, which would be turned off when using |
Sorry I'm actually referring to using the populate hook, I'm not using the Mongoose populate at all. |
Mongoose model instances do not allow adding or removing properties. Therefore all hooks that do modify the result data only work with plain objects (returned by |
OK so i'm using this after hook
with schema
with lean on the term service, the population doesn't happen. The population only works if I set lean to false on the term service. |
|
@dottodot the ultimate answer is yes. You should be able to use lean and populate together. Ideally all services are set to |
The example I posted above doesn't work or do you need the full code. |
@dottodot it would be much more helpful if you could post a repo. That way I don't have to setup these services on my break from work. ;) |
I can confirm this (but I can't guarantee I'm not just being stupid!). Tracked it down to Logging this line out to the console gives back the object I want but without property populated. I logged out Unfortunately my codebase is closed-source but both are services generated by the |
If you do |
Thanks for your reply @daffl . Thanks! |
The legacy-populate converted any ORM objects it found. to regular JS objects. The current populate requires normal JS objects. We had a running discussion about whether all hooks should handle ORM objects, but decided that defaulting feathers-mongoose to |
Should I be able to use lean and populate together, I'm pretty sure you normally can with mongoose but I'm finding that population only works when lean is set to false on the model that's being populated.
The text was updated successfully, but these errors were encountered: