-
-
Notifications
You must be signed in to change notification settings - Fork 555
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
Jaybell/crud mongoose query params #509
base: master
Are you sure you want to change the base?
Jaybell/crud mongoose query params #509
Conversation
- basic CRUD operations - missing: aggregate functionality and more advanced operators
- joins with projections work by using mongoose populate
- can deeply nest joins to recursively populate through virtuals
- `getMany` will return an array of JSON objects now instead of array of Mongoose documents
- remove getTake and getSkip, included in abstract service now - fix extra $ for operators
…ain objects - `crud-response.interceptor.ts` will handle Mongoose Documents now - mongoose `.toObject()` will return getters and virtuals
Just a typo fix for tsconfig.json reference path: from 'crid-mongoose' to 'crud-mongoose'.
- Implements most filter conditions with transform functions to mongoose - Follows order of important when or and filter conditions exist together - TODO: nested queries
d1c38da
to
f6e2ce6
Compare
This still needs quite a few unit tests to test the filter, or and search on GET's but the issues mentioned in #435 should be fixed. |
@yharaskrik thanks bro |
@yharaskrik please ping me when I can merge it |
@zMotivat0r will do. I would like to get the test coverage up a bit before that happens just to make sure that the filters are being built correctly. And to test that populate issue. |
Awesome |
- create DeepPartial type in utils - use DeepPartial and ObjectLiteral from utils instead of from typeORM
- add operator map injection token - add mongoose operator map to map operators in @nestjsx/crud to operators in mongo - test mongoose crud service - rework request interceptor to allow for 1 operator to map to more than one operator if needed
I had to rework how the crud request interceptor works a small amount to ensure that some of the operators that are allowed can be used with mongoose. There is now an Can be provided like this:
This injection token is optional and if not provided will use the operators as is to query the DB. This will also allow for more Databases if they happen to use different syntax. One side effect of this that may need to be addressed is that the operators that are used after transformation with the operator map may need to be whitelisted in the validate operator function in the interceptor. This also decouples from TypeORM and adds Something to note: The operator map is only needed for mongoose if you are using operators that are not directly supported by mongoose. And not all operators are supported yet, the ones currently supported are:
Not sure if this is quite the best way to go, open to suggestions of how we can breach the gap between NoSQL query language (currently mongodb) and SQL. With the changes that I made I do not think we would be able to use more than one DB type with this package, although not sure if that was possible before or not either. |
Is there any roadmap to merge this? |
Any Updates here, would love to see this! |
Is there any news on this? |
it has been two years! |
We would like to use mongoose with NestJS, is it possible that you merge this PR? Thanks a lot. |
No description provided.