-
Notifications
You must be signed in to change notification settings - Fork 23
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
Export type from projection #123
Comments
After some digging into the source, I found export const caseListProjection = {
user: 1,
project: 1,
shortid: 1,
// studies: 1,
"studies._id": 1,
"studies.series.modality": 1,
"studies.series._id": 1,
"studies.studyDate": 1,
"studies.uploadStatus": 1,
"studies.description": 1,
description: 1,
folder: 1,
diagnosis: 1,
tags: 1,
published: 1,
meta: 1,
customLinks: 1,
createdAt: 1,
updatedAt: 1,
};
type CaseDefinitionDocument_List = ProjectionType<CaseDefinitionDocument, typeof caseListProjection> This appears to work as expected. One question I still have is if the dot notation subfields will project to the type definition correctly. Thanks again! |
That's the correct usage of the Regarding the dot-notation support, unfortunately that's not supported right now. But once mongodb/node-mongodb-native#2972 lands in mongodb, we should be able to use the same code to add support here as well. |
That's great to hear, thanks! |
Is it possible to generate/export a type that is the result of a query with projection? I have a certain projection of a model that I use for a list format in the UI. I'd like to be able to create a new type/interface from that projection for type checking on the client. Thanks for this great library by the way!
The text was updated successfully, but these errors were encountered: