Enterprise Nest.js: Build an Abstract MongoDB Repository
Вставка
- Опубліковано 8 вер 2024
- Github Repo: github.com/mgu...
Previous Video on MongoDB + Nest.js: • Setup MongoDB With Nes...
Get my highly-rated Udemy courses at a discount here: michaelguay.de...
Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/
Sweet video, very informative and slick use abstract class.
Could be cool to do a video on multi-tenant setup in nestjs for example when different tenants have different db connections
this whole series is gold. I has struggling to understand how to build apps like this. Thank you.
I like the abstract way.
Thank you.
Thanks so much for this and all your other videos. You're really well versed in nestjs and appreciate you sharing your knowledge!
Thank you very much!
this video and all your videos are helpful, all love💓
Thank you very much i really like how you explain
Perfecto Mister
Thank you. I need to figure out Postgres way :)
wowzers
Thank you again. You're a god!
Thanks a lot
Thanks, great video. Just want to mention you may get some error in the projection part in find and findOne
"With the exception of the _id field, you cannot combine inclusion and exclusion statements in projection documents." so if you put __v: 0 and try to project other fields using {userId:1, email:1}
it will give an error since this does not allow in MongoDB. so in case if this happens you can remove the __v:0 part in the projection.
Thank you for the heads up!
can we implement this kind of abtraction with ORMs like prisma ?
i tried to do it with prisma but the typing and the filterQuery doesnt exist as type in prisma
thanks this helps a lot on improve my project. one question, how could I do the same with a service ? supose I have multiple service that wait for a event emitter "get.products" and all of them will execute another class that will return an array of products
how can I do this kind of abstraction?
thank you so much man!
as far as I know, repositories should be database agnostic, meaning it does not matter why database you are using, but I see that you extends Document from mongoose ?
can you please elaborate ?
When I try new this.entityModel(createEntityData) typescript warns that Argument of type 'unknown' is not assignable to parameter of type 'AnyKeys & AnyObject'
Thank you very much!!!!
thank you so much for this guide i have small question can i ask in why you use exec() in abstract class but not use it before on UserRepository class
Thanks for the video Michael!!
Could somebody please elaborate why unknown is used as a type for createEntityData and UpdateQuery? The object we would pass should always contain properties which are present in the Model right? So why unknown?
Hi Michael, thank you for your videos. It is possible to implement Pagination on the abstact repository and how can I do that?
is there any default method / prototype that already created by mongoose so we can just use them with extends, like using typeorm we can just implements repository pattern with extends repository, and import { Repository } from typeorm
I'm wondering how could it look using aggregations
what if you want to implement other methods as well, like findByName etc
@__main__ oops
Hi) I have a question, can we create the abstract class for controllers and extend them, for example, CrudController? And pass somehow dto
Yeah absolutely! Maybe I'll do a video showing this.
@@mguay I'm super interested in your approach on this 👀🚀
Great vid, but it's not Repository in your specific case, it's DAO.
Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/
Hi! Great tutorial, thankyou very much. I wanted to ask how do you manage situations when you have multiple schemas in their respective modules and lets say two of them are related with a "ref", and you to validate that there exists a record in the ref schema before you create a record in other schema?
Currently I do it by importing the ref schema in my second module, then import it in my service and have a check before the create function. Is it the right thing to do?