Complete MongoDB Tutorial #9 - Nested Documents

Sdílet
Vložit
  • čas přidán 27. 03. 2022
  • 🐱‍💻 View this course & other premium courses without ads on the Net Ninja Pro site:
    net-ninja-pro.teachable.com/p...
    🐱‍💻 Access the course files on GitHub:
    github.com/iamshaunjp/complet...
    (lesson code available from lesson 15 onwards)
    🐱‍💻 Modern JavaScript Course:
    On Net Ninja Pro - netninja.dev/p/modern-javascr...
    On Udemy - www.thenetninja.co.uk/udemy/m...
    On CZcams - • Modern JavaScript Tuto...
    🐱‍💻 Node.js Crash Course:
    On Net Ninja Pro - netninja.dev/p/node-js-crash-...
    On CZcams - • Node JS Tutorial for B...
    🐱‍💻 VS Code - code.visualstudio.com/
    🐱‍💻 Download MongoDB - www.mongodb.com/try/download/...

Komentáře • 54

  • @_rtdp_
    @_rtdp_ Před rokem +17

    Single document: {
    title: "The Way of Kings",
    author: "Brandon Sanderson",
    rating: 9,
    pages: 320,
    genres: ["fantasy"],
    reviews: [{
    name: "Yoshi",
    body: "Great book!!!"
    },
    {
    name: "mario",
    body: "So so"
    }
    ]
    })

  • @phamtiensang3316
    @phamtiensang3316 Před rokem +20

    insertMany:
    [ { title: 'The Light Fantastic', author: 'Terry Pratchett', pages: 250, rating: 6, genres: ['fantasy', 'magic'], reviews: [ { name: 'Luigi', body: 'It was pretty good' }, { name: 'Bowser', body: 'Loved It!!!' }, ], }, { title: 'The Name of the Wind', author: 'Patrick Rothfuss', pages: 500, rating: 10, genres: ['fantasy'], reviews: [{ name: 'Peach', body: 'One of my favs' }], }, { title: 'The Color of Magic', author: 'Terry Pratchett', pages: 350, rating: 8, genres: ['fantasy', 'magic'], reviews: [ { name: 'Luigi', body: 'It was OK' }, { name: 'Bowser', body: 'Really good book' }, ], }, { title: '1984', author: 'George Orwell', pages: 300, rating: 6, genres: ['sci-fi', 'dystopian'], reviews: [ { name: 'Peach', body: 'Not my cup of tea' }, { name: 'Mario', body: 'Meh' }, ], },]

  • @abdellahiaioun8430
    @abdellahiaioun8430 Před 6 měsíci +3

    The least I can do is like and say thank you.
    I will do this insha'Allah on every video I watch :)

  • @adhammagdy730
    @adhammagdy730 Před rokem

    Good job
    you can also cover sorting with specifying a collation because the normal sort covered in video is case-sensitive.

  • @quanghungtran7400
    @quanghungtran7400 Před 10 měsíci +57

    correct as author for many documents: [{title: "The Light Fantastic", author: "Terry Pratchett", pages: 250, rating: 6, genres: ["fantasy", "magic"], reviews: [{name:"luigi", body: "it was pretty good"}, {name: "bowser", body: "loved it!!"}]}, {title: "The Name of the Wind", "author": "Patrick Rothfuss", page: 500, "rating": 10, genres: ["fantasy"], review: [{name: "peach", body: "one of my favs"}]}, {title: "The Color of Magic", "author": "Terry Pratchett", page: 350, "rating": 8, genres: ["fantasy", "magic"], review: [{name: "luigi", body: "it was ok"}, {name: "bowser", body: "really good book"}]}, {title: "1984", "author": "George Orwell", page: 300, "rating": 6, genres: ["sci-fi", "dystopian"], review: [{name: "peach", body: "not my cup of tea"}, {name: "mario", body: "meh"}]}]

    • @shirohinraj736
      @shirohinraj736 Před 3 měsíci +1

      thanks for your effort and its helps my laziness to just copy paste it rather than typing it

    • @kelsiebrown8609
      @kelsiebrown8609 Před 6 dny

      This was so helpful, thank you! I noticed a couple typos when I C&P. There are " " around a couple of your author and rating fields. Here's the corrected code:
      [{title: "The Light Fantastic", author: "Terry Pratchett", pages: 250, rating: 6, genres: ["fantasy", "magic"], reviews: [{name:"luigi", body: "it was pretty good"}, {name: "bowser", body: "loved it!!"}]}, {title: "The Name of the Wind", author: "Patrick Rothfuss", page: 500, rating: 10, genres: ["fantasy"], review: [{name: "peach", body: "one of my favs"}]}, {title: "The Color of Magic", author: "Terry Pratchett", page: 350, "rating": 8, genres: ["fantasy", "magic"], review: [{name: "luigi", body: "it was ok"}, {name: "bowser", body: "really good book"}]}, {title: "1984", author: "George Orwell", page: 300, rating: 6, genres: ["sci-fi", "dystopian"], review: [{name: "peach", body: "not my cup of tea"}, {name: "mario", body: "meh"}]}])

  • @TheAzmi009
    @TheAzmi009 Před 2 lety +2

    Waited eagerly for this one.. could you make videos more often sir because we miss you!

  • @Vlad-sw4zd
    @Vlad-sw4zd Před 4 měsíci

    Thanks for that clarification on an approach of how I am supposed to decide wheather I want to create another collection or create an array of collections inside an existing collection. One data fetch request - one collection seems to be a nice guideline.

  • @meriemotman5852
    @meriemotman5852 Před 2 lety +11

    I liked the video before watching it because I know it's going to be so useful, you've helped me a lot so thank you sir

  • @vedant6460
    @vedant6460 Před rokem +1

    Thanks a lot for this video man!!! 💯💯💯💯💯💯💯

  • @moe9647
    @moe9647 Před 2 lety

    Best Teacher on the Internet

  • @Eslam-ig2gf
    @Eslam-ig2gf Před rokem

    Man I love you, Thank you so much for these vedios

  • @aggelikitsipira4330
    @aggelikitsipira4330 Před rokem

    So, if you want a nested document inside a nested document you need to write all the code for the first nested document(Like a path)?

  • @giorgiobrugnone6879
    @giorgiobrugnone6879 Před 9 měsíci

    Great viudeo tnx, justo a question.
    How can i filter books by a specify genre?
    Thank you for reply

  • @swarnatharar5440
    @swarnatharar5440 Před 10 měsíci +2

    If nested documents got a new object I'd separately, canwe update it directly?

  • @santrawebtech35
    @santrawebtech35 Před 2 lety

    you are the best mern stack teacher i have seen please start a series on redux-saga please please please and thank you for teaching

    • @jijobuje
      @jijobuje Před rokem

      @@internet4543 What platform do you suggest to follow the new techs

  • @corneliollagas5378
    @corneliollagas5378 Před 11 měsíci

    Man I need your suggestion what is the best database software for web system and pos system for local connection, and also what is the best programming language for creating these two(2) that I mention. Thanks man.

  • @arunrajkumard5238
    @arunrajkumard5238 Před 2 lety

    Hi where should I start react native from your channel play list

  • @arijayaputra216
    @arijayaputra216 Před rokem

    Thankyou

  • @rishabsharma5307
    @rishabsharma5307 Před 2 lety +1

    Also cover uploading images/videos/PDFs to mongodb

  • @keivansf3459
    @keivansf3459 Před rokem

    Amazing

  • @acw741
    @acw741 Před 2 lety +1

    why don't nested documents have a unique _id assigned to them automatically?

  • @saharghoniem1348
    @saharghoniem1348 Před rokem

    thanks

  • @riteeshacomputerscience4862

    How many more episodes are gonna be there ? Any ideas ?

  • @isaacqadri
    @isaacqadri Před 2 lety +1

    yeaaahhh ❤️❤️

  • @kveeeek695
    @kveeeek695 Před 2 lety

    Hi, I get a 404 when trying to access the github repo. Excellent course btw

  • @gileabiancaionela4107
    @gileabiancaionela4107 Před 5 měsíci

    I have a question. I don t understand why it is "db.books" if books is just the collection and bookstore is the database actually. I hope I am not wrong, but also I would need some help to understand. Thank you!

  • @moe9647
    @moe9647 Před 2 lety

    Can you do a ruby on rails Series

  • @S_Saurav
    @S_Saurav Před 7 měsíci

    completed

  • @pabas3792
    @pabas3792 Před 2 lety +2

    Does anyone have this list of books?

    • @mohammad-hosseinhashemian6804
      @mohammad-hosseinhashemian6804 Před 2 lety

      if u found it, pls tell me too

    • @pTownKyle
      @pTownKyle Před 2 lety +19

      *** Insert One ***
      title: "The Way of Kings",
      author: "Brandon Sanderson",
      rating: 9,
      pages: 400,
      genres: ["fantasy"],
      reviews: [
      { name: "Yoshi", body: "Great Book!!!" },
      { name: "Mario", body: "So So..."}
      ]
      *** Insert Many ***
      [
      {
      title: 'The Light Fantastic',
      author: 'Terry Pratchett',
      pages: 250,
      rating: 6,
      genres: ['fantasy', 'magic'],
      reviews: [
      { name: 'Luigi', body: 'It was pretty good' },
      { name: 'Bowser', body: 'Loved It!!!' },
      ],
      },
      {
      title: 'The Name of the Wind',
      author: 'Patrick Rothfuss',
      pages: 500,
      rating: 10,
      genres: ['fantasy'],
      reviews: [{ name: 'Peach', body: 'One of my favs' }],
      },
      {
      title: 'The Color of Magic',
      author: 'Terry Pratchett',
      pages: 350,
      rating: 8,
      genres: ['fantasy', 'magic'],
      reviews: [
      { name: 'Luigi', body: 'It was OK' },
      { name: 'Bowser', body: 'Really good book' },
      ],
      },
      {
      title: '1984',
      author: 'George Orwell',
      pages: 300,
      rating: 6,
      genres: ['sci-fi', 'dystopian'],
      reviews: [
      { name: 'Peach', body: 'Not my cup of tea' },
      { name: 'Mario', body: 'Meh' },
      ],
      },
      ];

    • @mohammad-hosseinhashemian6804
      @mohammad-hosseinhashemian6804 Před 2 lety +3

      @@pTownKyle thx mate

  • @engkunasya
    @engkunasya Před 11 měsíci

    HAHAHA mario adrion😂

  • @Pareshbpatel
    @Pareshbpatel Před rokem

    {2022-12-28}, {2023-09-07}

  • @GoobNoob
    @GoobNoob Před rokem +2

    Dislike. I find it very distasteful to be using all these examples for inputs, the fact you copy and paste, but expect us to sit here and manually type each one is ridiculous. It's a good tutorial, but I do suggest you either put it in the description or pin a comment, so we can actually follow along. This is how you lose views per video, when people can't even reasonably follow along.

    • @jordanhanna6884
      @jordanhanna6884 Před 11 měsíci

      Dislike. Your comment is not a reasonable request, and is not something you should expect from this type of video.

  • @bp4283
    @bp4283 Před 10 měsíci +3

    {"title":"The Light Fantastic","author":"Terry Pratchett","pages":250,"rating":6,"genres":["fantasy","magic"],"reviews":[{"name":"Luigi","body":"It was pretty good"},{"name":"Bowser","body":"Loved It!!!"}]},{"title":"The Name of the Wind","author":"Patrick Rothfuss","pages":500,"rating":10,"genres":["fantasy"],"reviews":[{"name":"Peach","body":"One of my favs"}]},{"title":"The Color of Magic","author":"Terry Pratchett","pages":350,"rating":8,"genres":["fantasy","magic"],"reviews":[{"name":"Luigi","body":"It was OK"},{"name":"Bowser","body":"Really good book"}]},{"title":"1984","author":"George Orwell","pages":300,"rating":6,"genres":["sci-fi","dystopian"],"reviews":[{"name":"Peach","body":"Not my cup of tea"},{"name":"Mario","body":"Meh"}]}

  • @150-mangleshkumar8
    @150-mangleshkumar8 Před měsícem

    im getting a MongoServerError: E11000 duplicate key error collection: CustomerDB.activevisitors index: listofpersons.listofpersons.aadharNumber_1 dup key: { listofpersons.listofpersons.aadharNumber: null } when i try to insert more than 1 times please help

  • @sudarrshang8922
    @sudarrshang8922 Před rokem +2

    * Insert One *
    title: "The Way of Kings",
    author: "Brandon Sanderson",
    rating: 9,
    pages: 400,
    genres: ["fantasy"],
    reviews: [
    { name: "Yoshi", body: "Great Book!!!" },
    { name: "Mario", body: "So So..."}
    ]
    * Insert Many *
    [
    {
    title: 'The Light Fantastic',
    author: 'Terry Pratchett',
    pages: 250,
    rating: 6,
    genres: ['fantasy', 'magic'],
    reviews: [
    { name: 'Luigi', body: 'It was pretty good' },
    { name: 'Bowser', body: 'Loved It!!!' },
    ],
    },
    {
    title: 'The Name of the Wind',
    author: 'Patrick Rothfuss',
    pages: 500,
    rating: 10,
    genres: ['fantasy'],
    reviews: [{ name: 'Peach', body: 'One of my favs' }],
    },
    {
    title: 'The Color of Magic',
    author: 'Terry Pratchett',
    pages: 350,
    rating: 8,
    genres: ['fantasy', 'magic'],
    reviews: [
    { name: 'Luigi', body: 'It was OK' },
    { name: 'Bowser', body: 'Really good book' },
    ],
    },
    {
    title: '1984',
    author: 'George Orwell',
    pages: 300,
    rating: 6,
    genres: ['sci-fi', 'dystopian'],
    reviews: [
    { name: 'Peach', body: 'Not my cup of tea' },
    { name: 'Mario', body: 'Meh' },
    ],
    },
    ];

  • @zubairhamid1453
    @zubairhamid1453 Před 4 měsíci +1

    if you are using postman to insertmany [{"title": "The Light Fantastic", "author": "Terry Pratchett", "pages": 250, "rating": 6, "genres": ["fantasy", "magic"], "reviews": [{"name":"luigi", "body": "it was pretty good"}, {"name": "bowser", "body": "loved it!!"}]}, {"title": "The Name of the Wind", "author": "Patrick Rothfuss", "pages": 500, "rating": 10, "genres": ["fantasy"], "reviews": [{"name": "peach", "body": "one of my favs"}]}, {"title": "The Color of Magic", "author": "Terry Pratchett", "pages": 350, "rating": 8, "genres": ["fantasy", "magic"], "reviews": [{"name": "luigi", "body": "it was ok"}, {"name": "bowser", "body": "really good book"}]}, {"title": "1984", "author": "George Orwell", "pages": 300, "rating": 6, "genres": ["sci-fi", "dystopian"], "reviews": [{"name": "peach", "body": "not my cup of tea"}, {"name": "mario", "body": "meh"}]}]

    • @WM_1310
      @WM_1310 Před 2 měsíci

      You're a lifesaver!!!