Complete MongoDB Tutorial #9 - Nested Documents
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/...
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
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
The least I can do is like and say thank you.
I will do this insha'Allah on every video I watch :)
Good job
you can also cover sorting with specifying a collation because the normal sort covered in video is case-sensitive.
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"}]}])
Waited eagerly for this one.. could you make videos more often sir because we miss you!
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.
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
@@isaacqadri Yes, indeed
Thanks a lot for this video man!!! 💯💯💯💯💯💯💯
Best Teacher on the Internet
Man I love you, Thank you so much for these vedios
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)?
Great viudeo tnx, justo a question.
How can i filter books by a specify genre?
Thank you for reply
If nested documents got a new object I'd separately, canwe update it directly?
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
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.
Hi where should I start react native from your channel play list
Thankyou
Also cover uploading images/videos/PDFs to mongodb
Amazing
why don't nested documents have a unique _id assigned to them automatically?
thanks
How many more episodes are gonna be there ? Any ideas ?
yeaaahhh ❤️❤️
Hi, I get a 404 when trying to access the github repo. Excellent course btw
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!
Can you do a ruby on rails Series
completed
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
HAHAHA mario adrion😂
{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.
{"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"}]}
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
* 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' },
],
},
];
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!!!