Many to Many relation in mongoDB

  Рет қаралды 37,568

Hitesh Choudhary

Hitesh Choudhary

5 жыл бұрын

Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
All the learning resources such as code files, documentations, articles and community discussions are available on our website:
chaicode.com/
You can find our discord link, github link etc on the above website.
Twitter/X link: x.com/hiteshdotcom
Discord link: hitesh.ai/discord
Learn React with 10 projects: • Let's learn react from...
Learn Docker: • A practical guide on D...
Learn Kubernetes: • Complete Kubernetes Co...
How does a browser works: • How does a browser wor...
How nodejs works: • How node JS works | En...
Learn Redux-toolkit: • Learn Redux Toolkit in...
Learn NextJS: • Nextjs Full stack course
Learn Typescript: • Why to learn Typescript
Learn Javascript: • Welcome to new JavaScr...
Learn React Native: • React Native Mastery: ...
Learn Zustand: • React state management...
Learn Golang: • How to get started wit...

Пікірлер: 103
@collink7145
@collink7145 4 жыл бұрын
While these are both many-to-many relationships, the intersection table is bidirectional, while the sub-collection approach is only unidirectional. With intersection table, you can readily see which users have purchased a given course, but when all of the purchase data is stored in the user document itself, you have to traverse all of the users and aggregate that data manually...unless I'm missing something.
@rishiktiwari
@rishiktiwari 4 жыл бұрын
3:35 - He means one more collection (equivalent to a table in SQL). Document is equivalent to a row in tables.
@rajeshdonepudi1
@rajeshdonepudi1 4 жыл бұрын
Love this series.
@sklearn9391
@sklearn9391 4 жыл бұрын
thanks for awesome way of explaining with beautiful smile...keep smiling
@MrAnupkash
@MrAnupkash 3 жыл бұрын
The intersection approach seems better and more reliable, as it avoids making the users and courses documents heavier with keys and refs. With intersection approach, querying the data from users -> courses or from courses -> users seem efficient and easy...A wonderful tutorial to watch on mongo associations... thank you!!!
@tejassarvaiya5589
@tejassarvaiya5589 Жыл бұрын
always help these video, and like a way to explaining every topic in a simple way
@anonysmooth648
@anonysmooth648 4 жыл бұрын
very detailed tutorial, keep it up bro. thanks you so much god bless you
@pratiksukhe8560
@pratiksukhe8560 5 жыл бұрын
Mongodb series is awesome. I absolutely loving it. plz make more videos on it
@alexnedin
@alexnedin 5 жыл бұрын
Thank you for the teaching Hitesh 👍 Waiting for the next lesson, and in the meantime jumping on your ReactJS course.
@rachitmahajan7868
@rachitmahajan7868 5 жыл бұрын
awsome series keep going sir!!!!
@seniorx9173
@seniorx9173 2 жыл бұрын
best development tutorial ..i am excited to buy node js course
@tejasjani2544
@tejasjani2544 3 жыл бұрын
Thank you Hitesh Sir👨‍💻❤️. I am working with 🔥firebase. And this mongo DB tutorial for (No SQL) relationships👫 are very useful for me
@TomSkylark
@TomSkylark 3 жыл бұрын
Super helpful. Thank you!
@anshikgupta2993
@anshikgupta2993 5 жыл бұрын
Sir please work with big amount of data
@pjguitar15
@pjguitar15 3 жыл бұрын
You are the best best BEST teacher ever
@remoteqa6311
@remoteqa6311 3 жыл бұрын
Excellent, thanks for the help full tutorial...
@yashpalgandhi4108
@yashpalgandhi4108 3 жыл бұрын
Thanks for amazing playlist on MongoDB
@wehavebeenthere126
@wehavebeenthere126 4 жыл бұрын
Thanks! great guide to mongo!
@shalakamhetre8093
@shalakamhetre8093 3 жыл бұрын
This series helping a lot to lean mongodb
@nikhil.pandey
@nikhil.pandey 5 жыл бұрын
Thanks sir.... Appreciate your efforts
@abhishekkapoor692
@abhishekkapoor692 5 жыл бұрын
hey thanx man, you really help a lot.
@davidobodo3605
@davidobodo3605 Жыл бұрын
awesome, thank you very much
@ProgrammingWithProject
@ProgrammingWithProject 5 жыл бұрын
Thanks sir for this series
@blasttrash
@blasttrash 4 жыл бұрын
Just to clarify, users, courses and purchase are not documents. They are collections. In sql if you call it a table, in mongo, its a collection. A document in mongo world would then be a single row from a sql table.
@Atulchourasia01
@Atulchourasia01 3 жыл бұрын
Great effort sir we will give the same effort in learning from the resources you provided 👏👏👏🙏
@rufatzeynalli5538
@rufatzeynalli5538 5 жыл бұрын
Man, i appreciate for your contribution to community :) this solution doesnt help too much, but thanks again :)
@a.yashwanth
@a.yashwanth 4 жыл бұрын
Do you have any other approach?
@firstnamelastname4685
@firstnamelastname4685 3 жыл бұрын
why don't we use the old approach, that is creating a third collection, as you mentioned? Are there any disadvantages?
@kakhan2086
@kakhan2086 5 жыл бұрын
An amazing series thanks for the efforts sir :)
@HiteshChoudharydotcom
@HiteshChoudharydotcom 5 жыл бұрын
Thanks 😃
@sobhitdas3071
@sobhitdas3071 4 жыл бұрын
Sir Just a small note for every guy on windows cmd. In Command prompt/powershell to copy something just select the guy and tap with 2 fingers(for lappy) and where ever you want to paste it again 2 finger touch would surely do the trick
@HostDotPromo
@HostDotPromo 5 жыл бұрын
Relationships are super helpful for bigger apps 🔥
@sujanb3932
@sujanb3932 5 жыл бұрын
Sir plz continue this series...plz plz
@biswajeetpadhi5713
@biswajeetpadhi5713 4 жыл бұрын
Thanks for videos
@rokibDev
@rokibDev 2 жыл бұрын
Very helpful
@phani_kiran
@phani_kiran 4 жыл бұрын
Is there a way to append new "course_id" to existing courselist without removing the previous list of courses in courselist ?
@anshikgupta2993
@anshikgupta2993 5 жыл бұрын
Sir please drop a video related to dbRefs everything related to that in mongodb that'll be very helpful
@kushagraankit1578
@kushagraankit1578 3 жыл бұрын
Windows users who are unable to copy can perform below steps to copy anything from your cmd.. Step1: Right Click on the task bar of your cmd and go to properties. Step2: Click and enable the ctrl+shift as copy command mentioned there then u can copy the selected area as ctrl+shift+c and paste as ctrl+shift+v
@arjunshivhare8998
@arjunshivhare8998 Жыл бұрын
Thank you
@keniljoshi6092
@keniljoshi6092 2 жыл бұрын
good course
@Gbyrd99
@Gbyrd99 3 жыл бұрын
I would say the one knock i would say is that when you are creating a bridge table you should always use the tables that you are bridging. ie it should be called userCourses in the first example
@muditmohantyagi
@muditmohantyagi 3 жыл бұрын
But how to access both tables as join or something else at once.
@shbita
@shbita 5 жыл бұрын
Thanks man
@MohitSingh-po1rw
@MohitSingh-po1rw 5 жыл бұрын
what is a user have purchased multiple courses, do we have to give the key names as purchaseID,..... , instead of that can't we simply create an object inside the user named purchases with keys course,course?, what is preferred the most here, Object or a List ?
@harshilbulsara4053
@harshilbulsara4053 3 жыл бұрын
Suppose we have multiple courses, so what to do if we want to calculate price of the courses in purchase table???
@be_29_salim_samim_khansali10
@be_29_salim_samim_khansali10 5 жыл бұрын
thank for video
@akshitagarg5914
@akshitagarg5914 5 жыл бұрын
How to get the list of documents in a database?
@SamareshMaity231
@SamareshMaity231 4 жыл бұрын
thank you
@manishverma9987
@manishverma9987 5 жыл бұрын
Hello Sir, Can you please share that, where you learn about programming, coding, technology, and this kind of technique?
@Pareshbpatel
@Pareshbpatel Жыл бұрын
MongoDb: Many-to-Many relationships so clearly defined. Thanks, Hitesh {2022-12-23}
@silberJon
@silberJon 4 жыл бұрын
is this way of nesting array of relational documents in both models performant?? seems incredibly wasteful but is it better, performance wise, than holding a classic many to many documents array?
@charannara3050
@charannara3050 4 жыл бұрын
Sir you said you'll discuss about why data in mongodb is not persistent when restarting it, I've checked in other videos but didn't find the solution for, how to save the data permanently in mongodb?
@mubin986
@mubin986 5 жыл бұрын
This approach is not applicable when a customer buys a product with multiple quantity. Or, a system may want to give the customer the customisation of a product (example: color, quantity, size etc.) In this case, a purchase table is required definitely. So, it's a good practice to use purchase table and, store purchase unique id in customer table to track the purchase or modify it later.
@farhan787
@farhan787 5 жыл бұрын
As Hitesh sir said in almost all videos of this Mongo DB series, it depends on the need of application. Since, we don't need colour, quantity, size in the scenario that Hitesh sir used in this video, so it was a perfect approach.
@shashanksinha6966
@shashanksinha6966 3 жыл бұрын
But is this solution scalable? How about the number of users for a particular goes in million? Will it not be difficult to maintain document
@awesomeclicks722
@awesomeclicks722 4 жыл бұрын
thanks
@Arun-wi9ir
@Arun-wi9ir 4 жыл бұрын
Hi Hitesh, Regarding Relation in mongodb can you share more videos .no much clarity on Relations
@aninditadas7348
@aninditadas7348 3 жыл бұрын
Again, Thanks for the Video, but how can an user delete a single purchaseid, if he added in users collection? Is there any way ->users->purchaselist->purchaseid>delete, Sorry I am a beginner
@ozgenx7249
@ozgenx7249 3 жыл бұрын
Thank you for the video very helpful. I need help modelling a relationship where a single product is sold by multiple vendors on a multivendor site using MongoDB. For example you have different vendors having different prices for a specific iPhone.
@ziaulhaqp5769
@ziaulhaqp5769 3 жыл бұрын
For Windows Users You can do Copy Paste in Command Prompt. Just select the text and Press "Enter" it will get copied and then "RightClick" to Paste
@rikyriky966
@rikyriky966 5 жыл бұрын
I always use intersection tables as a rule.
@abhisheksinghbhadauriya
@abhisheksinghbhadauriya 5 жыл бұрын
Thanks for teaching us this amazing MongoDB course with so much enthusiasm
@sriramtorvi7417
@sriramtorvi7417 4 жыл бұрын
Windows users can use PowerShell instead.
@GurdeepSingh-gr7fb
@GurdeepSingh-gr7fb 5 жыл бұрын
Hello Sir, I have this issue currently, I am in 12 Grade and in my free time, I learn these techs Adobe Illustrator, Python, Android Development at the same time. After doing them for 2 months, now I occasionally feel overwhelmed. I think, to continue with one or two techs and will learn the third one later, but there is fear that I will lose the knowledge that I have gained through 2 months which will result in my time being wasted. What's your opinion on this, Should I go with two or fewer techs or continue with three.
@meyimagalot9497
@meyimagalot9497 4 жыл бұрын
As much as you can, never settle. Human brain is easily able to memorize 1 standard book of 200 pages per DAY and is not even coming close to the limit. You will never overwhelm your brain capacity. Keep learning until you have time and power to do it
@mujtabam265
@mujtabam265 5 жыл бұрын
Sir please roll out the update for the LCO app, we are unable to offline the videos and it take a lot time to load the videos and every one min or two mins the videos starts buffering it's really annoying sir, please roll out the update.
@alexnedin
@alexnedin 5 жыл бұрын
It’s definitely your internet or a device, I have no problems on my iPhone and iPad.
@tapashalder8039
@tapashalder8039 3 жыл бұрын
many to many relation data how to update?
@VivekPatel-jm7vr
@VivekPatel-jm7vr 5 жыл бұрын
Hello sir, i want to buy HP envy, so i want to know that if that laptop is best for me asa programmer,i am computer science student!!! So please reply as soon as possible!
@CODERSNEVERQUIT
@CODERSNEVERQUIT 5 жыл бұрын
Watch this video if u are confused about which laptop to buy kzbin.info/www/bejne/enLInGppf6eIh9U
@aishadeshmukh6907
@aishadeshmukh6907 5 жыл бұрын
Hi Sir, Please continue this series with more levels. I am really enjoying it.
@supunbandara1768
@supunbandara1768 3 жыл бұрын
anyone did that assignment??
@a.yashwanth
@a.yashwanth 4 жыл бұрын
What to do if the size of the array increases the 16mb document limit of mongodb? I am using mongodb to store messages in chat rooms. I created chat rooms, messages collections. All the messages in all rooms will be stored as documents in messages collection, the object ids of messages are stored in an array field (similar to one in the video) in each room.
@rishiktiwari
@rishiktiwari 4 жыл бұрын
I think you can use SQL for this purpose. In your chat room the relation is always one (user) to many (messages) so you technically don't need mongodb. Just create two SQL tables one for users another for messages.
@kumarshubham4392
@kumarshubham4392 3 жыл бұрын
use cassandra
@a.yashwanth
@a.yashwanth 3 жыл бұрын
@@rishiktiwari I had followed this approach only in mongodb by creating 2 collections.
@rishiktiwari
@rishiktiwari 3 жыл бұрын
@@a.yashwanth Yes, you can do a standard relational approach in MDb but it doesn't perform well as compared to any RDBMS. I too have implemented a mixed approach in MDb and now my aggregation pipelines are too big 😂. It will not be a problem if the computer is good or number of simultaneous users are less.
@a.yashwanth
@a.yashwanth 3 жыл бұрын
@@rishiktiwari yeah. I too had aggregation pipelines around 5-8.
@theeagle8180
@theeagle8180 5 жыл бұрын
Sir I need your help. Are you free
@axaysushir
@axaysushir 4 жыл бұрын
To copy in windows CMD, just select text you want to copy and right click on it to copy the text. To paste text in CMD write your command and again right click where you want to paste the text. your text is pasted . so simple!!!
@princeraj622
@princeraj622 5 жыл бұрын
Sir how many days will it take to learn JavaScript??
@CODERSNEVERQUIT
@CODERSNEVERQUIT 5 жыл бұрын
10-15 days are enough for basics then... Make project based on js and eventually u will learn it. Checkout my channel for amazing JavaScript content
@muhammadomer2259
@muhammadomer2259 7 күн бұрын
Think for a moment if a course is purchased by thousands of students then defiantly you will encounter large array document problem. Which may create performance problem. in my suggestions traditional relation database approach is better.
@barked2786
@barked2786 5 ай бұрын
😇
@ajay316
@ajay316 5 жыл бұрын
I think you are confusing collections with documents. Anyway good tutorials.
@blasttrash
@blasttrash 4 жыл бұрын
surprised that only few have recognized that so far.
@subhamray1203
@subhamray1203 4 жыл бұрын
@@blasttrash Yes I think that too.
@anshulgupta3795
@anshulgupta3795 5 жыл бұрын
First View and Comment
@mujtabam265
@mujtabam265 5 жыл бұрын
I am second...!!!
@iabhishekpatil4415
@iabhishekpatil4415 3 жыл бұрын
Windows User can copy the text from CMD,,,,,select the text and press CTRL+C or ENTER. It will not kill the terminal,,,RIGHT_CLICK to paste.
@Avinashkumar-xt4zq
@Avinashkumar-xt4zq 3 жыл бұрын
thanks
Exploring mocha, mongo and mongoose
7:44
Hitesh Choudhary
Рет қаралды 13 М.
Grouping in mongodb
24:51
Hitesh Choudhary
Рет қаралды 21 М.
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,4 МЛН
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 60 МЛН
Children deceived dad #comedy
00:19
yuzvikii_family
Рет қаралды 7 МЛН
How to Correctly Define Many-To-Many Relationships in Database Design
7:07
Save bandwidth while querying in mongoDB
11:28
Hitesh Choudhary
Рет қаралды 17 М.
AM Coder - Mongo/Mongoose Relationships - Many to Many with a Joint Collection and Populate
15:29
Web Development with Alex Merced
Рет қаралды 3,3 М.
MongoDB | One-To-One, One-To-Many, Many-To-Many
16:39
Teddy Smith
Рет қаралды 4,2 М.
Learn Prisma Relationships (1-1, 1-m, m-m)
26:32
TomDoesTech
Рет қаралды 16 М.
Demystifying Sharding in MongoDB
36:00
MongoDB
Рет қаралды 8 М.
MongoDB Schema Design Best Practices
50:39
Joe Karlsson
Рет қаралды 168 М.
SQL Server Tutorial - One-to-many and many-to-many table relationships
9:51
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 1,3 МЛН
Secret Wireless charger 😱 #shorts
0:28
Mr DegrEE
Рет қаралды 2,4 МЛН