Complete MongoDB Tutorial #9 - Nested Documents
HTML-код
- Опубликовано: 28 сен 2024
- 🐱💻 View this course & other premium courses without ads on the Net Ninja Pro site:
net-ninja-pro....
🐱💻 Access the course files on GitHub:
github.com/iam...
(lesson code available from lesson 15 onwards)
🐱💻 Modern JavaScript Course:
On Net Ninja Pro - netninja.dev/p...
On Udemy - www.thenetninj...
On RUclips - • Modern JavaScript Tuto...
🐱💻 Node.js Crash Course:
On Net Ninja Pro - netninja.dev/p...
On RUclips - • Node JS Tutorial for B...
🐱💻 VS Code - code.visualstu...
🐱💻 Download MongoDB - www.mongodb.co...
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"}]}]
thanks for your effort and its helps my laziness to just copy paste it rather than typing it
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"}]}])
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"
}
]
})
king
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
Yea He's the best teacher out there
@@towatch Yes, indeed
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.
Waited eagerly for this one.. could you make videos more often sir because we miss you!
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' }, ], },]
Thank You!
Thank You!
Not the hero we deserve...
Diamond!
I always ask myself why he don't put thing like this to github
Good job
you can also cover sorting with specifying a collation because the normal sort covered in video is case-sensitive.
Best Teacher on the Internet
Man I love you, Thank you so much for these vedios
why don't nested documents have a unique _id assigned to them automatically?
{"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"}]}
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
@@internet4543 What platform do you suggest to follow the new techs
Great viudeo tnx, justo a question.
How can i filter books by a specify genre?
Thank you for reply
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.
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!
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)?
Hi where should I start react native from your channel play list
thanks
Can you do a ruby on rails Series
Does anyone have this list of books?
if u found it, pls tell me too
*** 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' },
],
},
];
@@pTownKyle thx mate
completed
{2022-12-28}, {2023-09-07}
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.
Dislike. Your comment is not a reasonable request, and is not something you should expect from this type of video.
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"}]}]
You're a lifesaver!!!
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
The least I can do is like and say thank you.
I will do this insha'Allah on every video I watch :)
If nested documents got a new object I'd separately, canwe update it directly?
Thanks a lot for this video man!!! 💯💯💯💯💯💯💯
Also cover uploading images/videos/PDFs to mongodb
yeaaahhh ❤️❤️
I find it quite funny that you are using Brandon Sanderson for an example author in these videos, because I'm listening to them as I go jogging, and I'm literally jogging right by his house right now.
Haha no way. I've been watching his YT vids over the last few days too.
@@NetNinja I actually got to take his lecture writing class in University (The one that's now online).
How many more episodes are gonna be there ? Any ideas ?
Hi, I get a 404 when trying to access the github repo. Excellent course btw
HAHAHA mario adrion😂
Thankyou
Amazing
* 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' },
],
},
];