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...

КОМЕНТАРІ • 34

  • @mguay
    @mguay  7 місяців тому

    Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/

  • @hassan-qp4hn
    @hassan-qp4hn 2 роки тому +3

    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

  • @vk-fb4ox
    @vk-fb4ox 2 роки тому

    this whole series is gold. I has struggling to understand how to build apps like this. Thank you.

  • @amitmondal7427
    @amitmondal7427 3 роки тому +1

    I like the abstract way.
    Thank you.

  • @williamx0
    @williamx0 2 роки тому +1

    Thanks so much for this and all your other videos. You're really well versed in nestjs and appreciate you sharing your knowledge!

    • @mguay
      @mguay  2 роки тому

      Thank you very much!

  • @alihamoud6863
    @alihamoud6863 Рік тому

    this video and all your videos are helpful, all love💓

  • @ayoubguismi4558
    @ayoubguismi4558 3 роки тому +1

    Thank you very much i really like how you explain

  • @momentgi
    @momentgi 5 місяців тому

    Perfecto Mister

  • @mkroven
    @mkroven 3 роки тому +2

    Thank you. I need to figure out Postgres way :)

  • @moosegoose1282
    @moosegoose1282 Рік тому

    wowzers

  • @bbedyukh
    @bbedyukh Рік тому

    Thank you again. You're a god!

  • @isurumaldeniya9536
    @isurumaldeniya9536 3 роки тому +1

    Thanks a lot

  • @isurumaldeniya9536
    @isurumaldeniya9536 3 роки тому +1

    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.

    • @mguay
      @mguay  3 роки тому

      Thank you for the heads up!

  • @hoseinjahandideh2104
    @hoseinjahandideh2104 5 місяців тому

    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

  • @odev6764
    @odev6764 2 роки тому +1

    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?

  • @aleksandrgurnak3911
    @aleksandrgurnak3911 Рік тому

    thank you so much man!

  • @Hamdiby
    @Hamdiby Рік тому +1

    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 ?

  • @sashatsatryan5752
    @sashatsatryan5752 2 роки тому

    When I try new this.entityModel(createEntityData) typescript warns that Argument of type 'unknown' is not assignable to parameter of type 'AnyKeys & AnyObject'

  • @ayrtoncravero
    @ayrtoncravero 2 роки тому

    Thank you very much!!!!

  • @mohammadrezabehzadfar8122
    @mohammadrezabehzadfar8122 Рік тому

    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

  • @vighnesh-k
    @vighnesh-k 2 роки тому

    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?

  • @paneurhythmie
    @paneurhythmie Рік тому

    Hi Michael, thank you for your videos. It is possible to implement Pagination on the abstact repository and how can I do that?

  • @ikan5677
    @ikan5677 2 роки тому

    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

  • @therealwalim
    @therealwalim Рік тому

    I'm wondering how could it look using aggregations

  • @xenon4602
    @xenon4602 3 роки тому

    what if you want to implement other methods as well, like findByName etc

  • @dantedimon
    @dantedimon 2 роки тому

    Hi) I have a question, can we create the abstract class for controllers and extend them, for example, CrudController? And pass somehow dto

    • @mguay
      @mguay  2 роки тому +3

      Yeah absolutely! Maybe I'll do a video showing this.

    • @sergiuwaxmann
      @sergiuwaxmann 2 роки тому

      @@mguay I'm super interested in your approach on this 👀🚀

  • @volodymyrkulyk9373
    @volodymyrkulyk9373 2 роки тому

    Great vid, but it's not Repository in your specific case, it's DAO.

  • @mguay
    @mguay  7 місяців тому

    Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/

  • @noname13345
    @noname13345 8 місяців тому

    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?