feathersjs-ecosystem / feathers-mongoose

Easily create a Mongoose Service for Feathersjs.
MIT License
189 stars 96 forks source link

hooks.toObject() fails if data is paginated #77

Closed jack-guy closed 8 years ago

jack-guy commented 8 years ago

The hook only works for mongoose resources on result, not result.data. I'll probably submit a PR shortly.

jamesjnadeau commented 8 years ago

This adapter uses the mongoose .lean() functionality when fetching multiple results, that makes using .toObject() not necessary in this case. However, you could configure it to not use lean.

Please take a look at this discussion: https://github.com/feathersjs/feathers-mongoose/issues/51

jack-guy commented 8 years ago

@jamesjnadeau It defaults to false, and I'd rather not have it apply service-wide. Either way I think the hook should be fixed. Unless you just want to remove the hook entirely @daffl?

jamesjnadeau commented 8 years ago

My mistake then, in my head(and my projects), lean is true by default....

ekryski commented 8 years ago

@harangue yup this is totally valid. Thanks for bringing it up and tackling it Jack!