No video

One to many relation in mongo database

  Рет қаралды 62,544

Hitesh Choudhary

Hitesh Choudhary

Күн бұрын

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

Пікірлер: 74
@anshikgupta2993
@anshikgupta2993 5 жыл бұрын
This video is really helpful but I still didn't understood how to link documents or how to link collections if you can clarify with more videos
@rameshsuthar4341
@rameshsuthar4341 5 жыл бұрын
By using db.dropDatabase() command we would be able to delete one database at a time. So to delete multiply database we can use loop function like forEach() and loop all the database and delete them. The code:- Mongo().getDBNames().forEach(function(x) { if (['admin', 'config', 'local'].indexOf(x) < 0) { Mongo().getDB(x).dropDatabase(); } })
@dharmendraprasad198
@dharmendraprasad198 4 жыл бұрын
show dbs use oldStudents db.dropDatabse()
@Code-Patel
@Code-Patel 5 жыл бұрын
One question sir. What about when we need to add one more comment after inserting record? I mean to say what about when we need to update this db for add one new comment
@FeelFreeToCode
@FeelFreeToCode 5 жыл бұрын
Sir you are my motivator 👍😊😊😊😊
@paolourielenriquez9715
@paolourielenriquez9715 4 жыл бұрын
You inserted a comment with reply, in comments collection, but didn't associate the reply, in replies collection, to your comment. The inserted document in replies collection was useless.
@amanmanojpreeti
@amanmanojpreeti 3 жыл бұрын
To delete courses db: 1. use courses 2. db.dropDatabase()
@vipinkrishna6536
@vipinkrishna6536 5 жыл бұрын
use hiteshDB db.dropDatabase()
@sajed8077
@sajed8077 5 жыл бұрын
Love from Kashmir sir
@kartikgupta3756
@kartikgupta3756 4 жыл бұрын
How can we query the latest top 10 replies of that particular comment?
@narutodihargo
@narutodihargo 11 ай бұрын
00:00= One to One, 00:50= OneToMany example, 02:05= Drop databases,
@helloWorldPlus
@helloWorldPlus Жыл бұрын
Hello. And how would be done if the id is auto generated by the Atlas MongoDB and is not known?
@dharsan.s7937
@dharsan.s7937 5 жыл бұрын
Hi tech my bro / teacher I love u brooooo
@mritunjaisharma1242
@mritunjaisharma1242 4 жыл бұрын
how we can retrieve the data, if we have 2 database say 1db and 2db, in 1db we have 'user' collection which include some personal data like firstName, lastName, rollNumber in that we have some duplicate rollNumber user are persent and in db 2 we have 'trip' collection, where we have rollNumber, dateOfTravel, etc..which were created by respective rollNumber now how we can fetch the data which is having duplicate user detail from db 1 and respective trip also.
@danielalfonsogarcia7565
@danielalfonsogarcia7565 4 жыл бұрын
how do i add more elements to that array?
@dwezyow9146
@dwezyow9146 4 жыл бұрын
this is what i expected from the video, ops but theres nothing.
@ashishchhikara7829
@ashishchhikara7829 3 жыл бұрын
use array.push(element)
@code_react
@code_react 4 жыл бұрын
Well the second method is pretty good but i am thinking about memory of mongodb document. i guess it provides you 16mb size and i am sure that by using second method your memory will fill up very quickly. Note: i am not mongodb expert i am also beginner but i read that on mongodb docs.
@ArifAli-hl2xk
@ArifAli-hl2xk 3 жыл бұрын
what happen when someone edit that reply?
@NewtonIsLive
@NewtonIsLive 5 жыл бұрын
I wanted to know how to add a reply later when a comment has been inserted. and then how to fetch replies and their backwards how to know this reply belongs to which comment
@charans1845
@charans1845 3 жыл бұрын
If replies gets nested, how to design the database?. please reply.
@usamajaved3509
@usamajaved3509 2 жыл бұрын
> show dbs - list of Databases > use > db.dropDatabase()
@villanprabu7539
@villanprabu7539 3 жыл бұрын
why did you create new collection called replies. some time we got replies of replies multiple correct . but you can use same comments table and just refer comments id only
@SamareshMaity231
@SamareshMaity231 4 жыл бұрын
thank you
@FeelFreeToCode
@FeelFreeToCode 5 жыл бұрын
Great 💐👌👌👌👌
@gaganchoudhary6114
@gaganchoudhary6114 4 жыл бұрын
Use the delete delete('delete key':'delete data',()=>{using callback})
@kamranjaved5583
@kamranjaved5583 5 жыл бұрын
Sir , I am working on a webapp where app require a company signup, i want to create a separate db for each company. i am using mongoose for mongodb .. since mongodb doesn't support query to create Database. So what should i do so that i can create my DB dynamically in a node js application Please help me ..as i am new in this field
@wassaufkhalid8593
@wassaufkhalid8593 Жыл бұрын
A better approach could have been to use the id of the comment inside the reply object. This will not require addition of ids to comment each time while adding a new reply
@tejasmahajan4040
@tejasmahajan4040 4 жыл бұрын
Hi Hitesh, I have come across a scenario I have Hashmap in document Map, and I want to find document on basis of string which is present in List of value in map, is it possible can you please help me?
@johnnydriesen7575
@johnnydriesen7575 5 жыл бұрын
Supposing the next vid is going to be ... ManyToMany Relations ... Can't wait for it ... Since months, I'm struggling with situations like ... e.g. A Product has many Suppliers A Supplier delivers many Products A Product has a different price per Supplier ... Can't wait for a good solution :)
@nadim.a4351
@nadim.a4351 4 жыл бұрын
I'm sorry, months? you could just check the mongodb website. It's true that it's easier to just watch a video, but if I had no other option I would check the official website documentation instead of just waiting for a video.
@pradeepadmingradalpharecord
@pradeepadmingradalpharecord 4 жыл бұрын
Just an excercise to test my knowledge db.product.insertOne({name: "Product1", suppliers: [{supplier_id: "123", price: 321}, {supplier_id: "134", price: 341}]}); db.supplier.insertMany([{_id: "123", name: "Supplier1"}, {_id: "134", name: "Supplier2"}])
@temitopeagboolanuel
@temitopeagboolanuel 3 жыл бұрын
I'm also presently struggling with Mongoose populate which does the same thing. I've tried many methods, none is working; I've been literally frustrated by this.
@Srinath666
@Srinath666 Жыл бұрын
use and after that db.dropDatabase() to delete
@aninditadas7348
@aninditadas7348 3 жыл бұрын
Hello,Thanks for the video. But how can we edit a single reply, if we approach the second one?
@piyushtakale4648
@piyushtakale4648 4 жыл бұрын
someone please help me i have date stored in my mongodb database in ISO format i want to find documents using date in java i searched everywhere i havent found it. the problem is i have to store the date in the same iso format and search using date object only. and the date objects stores the date in like ... Thu Aug 20 00:00:00 IST 2020.... that is why its not working someone please help me
@hikari00xx
@hikari00xx 3 жыл бұрын
11:10 then what is this? an embedded or a link?
@darshanraut554
@darshanraut554 2 жыл бұрын
Waste of time
@viveks-yt
@viveks-yt 4 жыл бұрын
What's wrong in referring the document?
@angulardesign7412
@angulardesign7412 3 жыл бұрын
plz make on nodejs sequalize relationships hasmany like
@omarhegazi1613
@omarhegazi1613 4 жыл бұрын
these are a normal crud operations that has nothing to do with relations in mongodb , please understand the subject first before recording a video
@fincept-tilak2172
@fincept-tilak2172 5 жыл бұрын
Data science
@Satyam_js_04
@Satyam_js_04 4 жыл бұрын
Embedded or Referenced.
@prakharsingh4531
@prakharsingh4531 2 жыл бұрын
db.dropDatabase() command used to delete existing database
@taherlunavadi2559
@taherlunavadi2559 5 жыл бұрын
use youtube db.dropDatabase()
@jijinp1612
@jijinp1612 5 жыл бұрын
mongo youtube --eval "db.dropDatabase()"
@masifqadri12
@masifqadri12 3 жыл бұрын
Sorry Boss Not Agree with the current example in replies, table add _id column with reply/replies
@vishaltalukar6676
@vishaltalukar6676 5 жыл бұрын
Can to make videos on data science using python for free?
@krushna7467
@krushna7467 3 жыл бұрын
db.name.drop() ?
@teklezegergish
@teklezegergish 4 жыл бұрын
Use drop to delete from mongo DB
@techspider2528
@techspider2528 3 жыл бұрын
use exampledb db.dropDatabase()
@mr_don_key
@mr_don_key 5 жыл бұрын
very odd that you can explain relationships in mongo.. but are not able to remove collections.. :)
@praveenrangasubhe9374
@praveenrangasubhe9374 2 жыл бұрын
db.collectionname.drop()
@disasterunfold7885
@disasterunfold7885 3 жыл бұрын
db.dropDatabase() as simple as that
@vishaltalukar6676
@vishaltalukar6676 5 жыл бұрын
First
@pavanagarwal6753
@pavanagarwal6753 4 жыл бұрын
can i edit my comment? Answer is "yes"
@cristianyamidperezgranda2949
@cristianyamidperezgranda2949 4 жыл бұрын
Thanks, ¿what's is the best way to get all replies from all comments?, is convenient create other collection to duplicate all replies?, thank you, nice video
@muramullasiri5087
@muramullasiri5087 4 жыл бұрын
db.dropDatabase()
@sweetdevil3647
@sweetdevil3647 3 жыл бұрын
db.COLLECTION_NAME.drop() !!!
@akhilakhil9325
@akhilakhil9325 4 жыл бұрын
poor
@NewtonIsLive
@NewtonIsLive 5 жыл бұрын
you wasted my time , waste of time
@NewtonIsLive
@NewtonIsLive 5 жыл бұрын
you wasted my time..
@omkanade5
@omkanade5 3 жыл бұрын
show dbs use oldStudents db.dropDatabse()
Many to Many relation in mongoDB
10:18
Hitesh Choudhary
Рет қаралды 37 М.
One to one relation part 2
7:08
Hitesh Choudhary
Рет қаралды 9 М.
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 19 МЛН
managed to catch #tiktok
00:16
Анастасия Тарасова
Рет қаралды 46 МЛН
How does mongoDB works
11:23
Hitesh Choudhary
Рет қаралды 76 М.
Database issues with Update in mongodb
10:19
Hitesh Choudhary
Рет қаралды 19 М.
Understanding objects structure in mongoDB
13:25
Hitesh Choudhary
Рет қаралды 17 М.
MongoDB Schema Design Best Practices
50:39
Joe Karlsson
Рет қаралды 170 М.
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
MongoDB Crash Course - Schemas and Relationships
46:28
The Full Stack Junkie
Рет қаралды 43 М.
What is schema in mongoDB
11:25
Hitesh Choudhary
Рет қаралды 42 М.