Skip to content
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

Returned objects not lean. Cannot set lean option. (Typescript) #335

Closed
N8th8n8el opened this issue Aug 7, 2019 · 0 comments · Fixed by #336
Closed

Returned objects not lean. Cannot set lean option. (Typescript) #335

N8th8n8el opened this issue Aug 7, 2019 · 0 comments · Fixed by #336

Comments

@N8th8n8el
Copy link

Steps to reproduce

I am creating a feathers-service:

import service from 'feathers-mongoose';
...
 app.use('serviceName', service({Model: MyModel}));
...

I have noticed that, when I console.log(context.result); in an after hook (create) that the resulting object is not lean, i.e. it contains mongoDB stuff like __id and __v.
I tried to set the lean option explicitly:

  app.use('serviceName', service({Model: MyModel, lean: true}));

but then Typescript complains. The Problem is the following line (l.34 in types/index.d.ts) :

declare const mongoose: ((config?: Partial<MongooseServiceOptions>) => Service);

where MongooseServiceOptions extends ServiceOptions which in turn is imported from
@feathersjs/adapter-commons.

In adapter-commons/src/service.ts the said interface is exported, but the lean attribute is missing:

export interface ServiceOptions {
  events: string[];
  multi: boolean|string[];
  id: string;
  paginate: any;
  whitelist: string[];
  filters: string[];
}

System configuration

I am using Typescript.

Module versions (especially the part that's not working):
feathers-mongoose: 8.0.1
feathersjs: 4.3.0-pre.2

NodeJS version:
node:10-stretch

Operating System:
MacOS 10.14.6 running Docker Engine 19.03.1 and Compose 1.12.1
The application is running inside a docker container (node:10-stretch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant