Skip to content

Instantly share code, notes, and snippets.

@melvinkcx
Last active January 14, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvinkcx/db2482cdbed7813e84febcc4811eda94 to your computer and use it in GitHub Desktop.
Save melvinkcx/db2482cdbed7813e84febcc4811eda94 to your computer and use it in GitHub Desktop.
Enabling Virtuals In Mongoose Lean Mode (in a FeathersJs service)
// user.service.js
import createService from 'feathers-mongoose';
// other imports...
export default (app) => {
const Model = createModel(app);
// ...
const options = {
Model,
lean: {virtuals: true}, // add this line
};
const service = createService(options);
// ...
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment