Тёмный

Model Relational Data in Firestore NoSQL 

Fireship
Подписаться 3,1 млн
Просмотров 369 тыс.
50% 1

Learn how to model and structure data relationships with the Firestore NoSQL Database. We build simple one-to-many and many-to-many relationships by modeling a twitter-inspired app. angularfirebase.com/lessons/f...
- Firestore Structuring: firebase.google.com/docs/fire...
- NoSQL Document DB - en.wikipedia.org/wiki/Documen...

Наука

Опубликовано:

 

8 фев 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 214   
@Fireship
@Fireship 6 лет назад
Oops, meant to say "no greater than 1MB" at 1:10 - I hope this gives you some ideas for basic relational modeling in Firestore, but there are more advanced techniques that I will cover in the future.
@wilfrodebodo
@wilfrodebodo 6 лет назад
I’d love to see more techniques about data modelling. Keep up the good work :)
@y9tw0t
@y9tw0t 6 лет назад
😂 "documents need to be at least 1MB or smaller" left me scratching my head Anyway, thanks for the content.
@HassanMalikTW
@HassanMalikTW 6 лет назад
your technique of demonstrating possibilities is simply awesome, straight to the point, without diversions. well-rehearsed.. awesome ! :)
@peet91pop
@peet91pop 5 лет назад
how to check the size of the document ?
@binhcoolfreestyles
@binhcoolfreestyles 5 лет назад
​@@peet91pop I m not got the general content of this video, can I conclude it become 1 sentence "To create relationship in NoSQL, we can use both Normalize and Denormalize method?" Normalize is separate them to Collections, And Denormalize is use "Object Field"
@tarmac5482
@tarmac5482 3 года назад
This is perhaps the only channel where I watch in 1x and pause often.
@gamesland2067
@gamesland2067 3 года назад
That's funny because this video is the first video I watched in 1.75x
@sharbelokzan9673
@sharbelokzan9673 2 года назад
I was thinking the exact same thing lol I usually watch on X1.5 , or even faster in case I'm familiar with the subject But here on fireship no no no 😂 X1 speed and I need100% of my brain
@Beny123
@Beny123 2 года назад
Exactly . So dense with valuable information
@TheSUMMIE
@TheSUMMIE 2 года назад
@@gamesland2067 hey
@simonfeliperuavargas5134
@simonfeliperuavargas5134 4 года назад
I am a Spanish speaker and I appreciate your speech clarity and the knowledge of this channel. Thank you so much.
@domknguyen
@domknguyen 6 лет назад
Hands-down best video series on Angular and Firebase! Keep up the Firestore videos! We'll definitely need it since it's still in beta.
@user72974
@user72974 5 лет назад
For anyone watching this in Feb 2019 and following along, there is no more "object" field for the documents. It's now called "map".
@norbertocaceres6710
@norbertocaceres6710 5 лет назад
you saint
@LuisSierra42
@LuisSierra42 5 лет назад
Arigatou senpai
@pixeesoft
@pixeesoft 5 лет назад
The hero we need, not the hero we deserve.
@casperknudsen7086
@casperknudsen7086 4 года назад
nice to know. Just started working with it :D
@FamilyGuyVids11
@FamilyGuyVids11 4 года назад
cheers!
@razakadam74
@razakadam74 6 лет назад
Jeff, you make learning more fun for me. Thanks
@monome3038
@monome3038 6 лет назад
of all modeling videos, this one is the best. Thank you so so much!
@michaelffasd23
@michaelffasd23 6 лет назад
Great video Jeff, thank you! This was an excellent topic to cover. It confirmed what I already learned from talking to you in Slack, and gave me some extra insight.
@alexwilliams677
@alexwilliams677 6 лет назад
Awesome videos man, simple and straight to the point! Keep it up
@greggord-hume3979
@greggord-hume3979 2 года назад
Exactly the information I needed. The user -> tweets model is applicable to so many other applications.. like stores -> products. Which is how this helped me resolve my data structure. Thanks!
@mohamethseck
@mohamethseck 2 месяца назад
6 years old and it still helped me plan out the structure for my project. Thank you!
@davidakposibruke5444
@davidakposibruke5444 4 года назад
I just started working with databases and found firebase and your videos make understanding it so much easier and quicker. Great work!
@bienvenidovillabroza351
@bienvenidovillabroza351 3 года назад
Actually taught me NoSQL and Firestore at the same time. Amazing videos as usual.
@innerthreatcircus5651
@innerthreatcircus5651 6 месяцев назад
OMG, seeing this for the first time in my life to try to do something using flutterflow and firestore. Glad to finally see some noSQL stuff (I'm VERY SQL oriented for over 20 years using relational databases).
@sebbel3260
@sebbel3260 10 месяцев назад
Still useful today. Wow your videos have come far, and so has your voice!
@ArturoCamposConde
@ArturoCamposConde 5 лет назад
Your content is super awesome! Maybe you could one day do a video on how to get data from firestore to datastudio, I bet it would be incredibly useful not only for me. Keep it like that.
@danielborges.
@danielborges. 6 лет назад
Always a very good content by the way. Thanks for sharing. I am a very satisfied Pro Member and highly recommend it to all.
@Fireship
@Fireship 6 лет назад
+ Daniel I'm very glad to hear that, thanks for sharing your feedback :)
@antoinederoose499
@antoinederoose499 3 года назад
That's a great introduction to the NoSQL mindset thanks you
@algoconqueror3579
@algoconqueror3579 Год назад
The best explaination on Data modeling in Firestore👏👏
@hangchen6131
@hangchen6131 6 лет назад
Nice and helpful tutorial and hard to find one like this addressing data modeling specifically for firebase! But I have to watch at 0.5 speed to fully understand the content lol!
@Trinks
@Trinks 4 месяца назад
Great explanation mate. Just what I needed.
@martinschulze5399
@martinschulze5399 3 года назад
I just watch your half of your videos because of the voice combined with the background jingle :P no joke, love them
@hiringcafe
@hiringcafe 3 года назад
Hands down the best RU-vid channel for coding
@shoekneeawl
@shoekneeawl 5 лет назад
Hey Jeff, great video. Why don't you use the 'reference' data type? for a user document rather than creating a new field?
@anazi
@anazi Год назад
Wow I just implemented this approach using exactly the same method for a similar situation. I had problem with Firebase9 since I couldnt nest the likes inside a document inside a post So I decided to do take the easier approach and I was hoping the I didnt ruin my project. But after I watched your suggested video I feel 100x more confident about it. Thanks alot ❤️❤️
@JanacMeena
@JanacMeena 2 года назад
Exactly what i needed, thank you. Realized that I should just go with a SQL db
@budiedev5820
@budiedev5820 5 лет назад
finally i understand now how the noSQL work. thank for your awesome video.
@h.vats_
@h.vats_ 2 года назад
5:20 It is now possible to make queries across collections and subcollections with the same name using collection group queries.
@psaunder1975
@psaunder1975 5 лет назад
I agree, one of better videos that explains how to apply relational techniques to Firebase. This is what SQL developers are looking for to come over to Firebase.
@cesarmurillo6192
@cesarmurillo6192 3 года назад
Exactly, that have prevented me from entering into firebase in the past till recently I gave it a try and this video summarizes all what I have read along the way and what I have implemented.
@CarlosAlbertoBrasil
@CarlosAlbertoBrasil 4 года назад
thanks, answered really well the question, how we solve complex situations in noSql .... by yourself !
@SarShaGaming
@SarShaGaming 5 лет назад
Hey, What about lookup tables? How will you model those with firestore ?
@Pharaoh-99
@Pharaoh-99 5 лет назад
how would you get all tweets along with up to date user data such as user name and age not just user id ... like joins in sql
@raghav4296
@raghav4296 5 лет назад
G’day, a noob query: @7:00 - There was a mention to check if an user has hearted a post by checking whether the document exists for userid_tweetid. Doing this operation at scale, wouldn’t it easily consume lot of GET requests?Would it be a better alternative to write the hearted tweet id per user basis to Firestore and sync the same in realtime back to the client so that the client always have the list of tweets thus making the check locally than to reach the server?
@kyumamorita
@kyumamorita 5 лет назад
easy to understand. good job!!
@tomasznowak2032
@tomasznowak2032 3 года назад
Damn... this channel is A+ class.
@codingkidda5173
@codingkidda5173 6 лет назад
No one can beat you sir
@raghav4296
@raghav4296 5 лет назад
Hi Jeff, for the trick mentioned in 7:20 - Does a firestore call to check if the user has liked a post need to be made for every tweet he views? Will this not exponentially increase the read costs?
@cheldap-softcheldap-soft900
@cheldap-softcheldap-soft900 6 лет назад
whaou!!! wath a nice topic on a nice video, thanks
@yndrywjynsyn
@yndrywjynsyn 6 лет назад
Hi, I'm new to coding. Are these videos good for people trying to build a firebase database in Swift?
@javadziaebrahimi3568
@javadziaebrahimi3568 5 лет назад
awesome as always
@mateja176
@mateja176 6 лет назад
Jeff, you are awesome!!!
@Fireship
@Fireship 6 лет назад
+Mateja Thank you :)
@Leonardo_A1
@Leonardo_A1 8 месяцев назад
great Video .. Thanks from Germany Leonardo
@eduardorabanal2803
@eduardorabanal2803 5 лет назад
awesome video bro, thank you very much
@mike73783
@mike73783 5 лет назад
It would be helpful to see examples of typical queries. How would we get the tweets a specific user has liked? All of the tweets liked by that user? The tweets of user A that were liked by user B? I think I understand the concepts here but it hasn't quite clicked in my mind. Probably I just need to try some of these exercises myself.
@eduardodelagarza3318
@eduardodelagarza3318 5 лет назад
Did collection group queries made the part about the tweets obsolete?
@RafaelSantos-pq4od
@RafaelSantos-pq4od 6 лет назад
Eu estava com duvidas quanto a construção dos relacionamentos, foi de grande ajuda esse video. (I was in doubt as to the construction of the relationships, this video was very helpful.) - Follower of Brazil
@hooligansofts7430
@hooligansofts7430 5 лет назад
Hey, one question tho. I understand why we normalized the structure so that we can query all the tweets in a single day if we want to. But what about if the user wants to see all of his tweets? Are we looking at some data duplication in this case?
@vOnez212
@vOnez212 5 лет назад
I'm building an app with Angular and Firebase but would like to learn as much about Firebase (noSql) data modeling first. Any resources you can point me to. Thanks!
@yndrywjynsyn
@yndrywjynsyn 6 лет назад
Hi, this was a nice intro video for me. Do you plan to make longer video tutorials on this Firebase topic?
@ismailmohamed6108
@ismailmohamed6108 5 лет назад
at 7:10 .. Does that mean we will need to make a document id for each user with a specific tweet? that a huge data
@blasttrash
@blasttrash 4 года назад
episode 63? is this part of some series? if so where can I find the full series or playlist?
@jamesblock8384
@jamesblock8384 4 года назад
Check his channel. He offers a bunch of free videos on youtube. He also has some paid ones on his site at fireship.io I believe. There's also a stripe community you can join. His videos are by far the most useful I've found.
@ChilaKasonde
@ChilaKasonde 6 лет назад
Not an Angular guy but i use Firestore often this is truly amazing thanks alot
@Fireship
@Fireship 6 лет назад
Thank you! What do you use Firestore with?
@ChilaKasonde
@ChilaKasonde 6 лет назад
Angular Firebase Android development in native Java, actually modeling my current database using some of the principles you've mentioned
@kethdominictacatani5837
@kethdominictacatani5837 6 месяцев назад
Bro you deserve a subscribe!
@tankki1583
@tankki1583 4 года назад
6:52 How do you get the user info from 'tweets' collection if there's no join? example output will be: USER ONE - 'User tweet this one.' , USER TWO - 'This is other tweet from this user'
@codewithluca
@codewithluca 5 лет назад
Great explaination
@joshuapetitma6077
@joshuapetitma6077 3 года назад
3:34, you can now actually do this! Firebase is really growing and allows you to defined those queries.
@moomoomamoo
@moomoomamoo 5 лет назад
7:16 will using a composite id of the User and Tweet lead to issues involving hotspotting? "Avoid high read or write rates to lexicographically close documents" - Firestore best practices doc. I'm currently in the process of implementing some backend logic that uses this idea, but I'm concerned that this idea won't work in the long run.
@caiomar
@caiomar 4 года назад
this guy is on speed
@ajaykotiyal427
@ajaykotiyal427 4 года назад
Exactly, I was commenting on this. He is too fast. Although tutorial is good.
@StephenRayner
@StephenRayner 3 года назад
The speed is great!
@caiomar
@caiomar 3 года назад
@@StephenRayner ok
@mountainslopes
@mountainslopes 3 года назад
@@ajaykotiyal427 just slow it down in the RU-vid player!
@jesseb0rn51
@jesseb0rn51 3 года назад
Its called adhd
@inescherif5385
@inescherif5385 Год назад
thank u it helps me a lot
@Donaldo
@Donaldo 5 лет назад
Early in the video OP showed creating a document with userId and instructorId properties and claimed this was many-to-many. That's not mtm it's just two foreign key references from the same document to two documents in presumably the same collection. Maybe what OP meant to do was make the userId property and array of userId? Does firebase support multiple indexable values for a single field like elasticsearch?
@bstrnx
@bstrnx 6 лет назад
How do you model the data if you want to show only the tweets tweeted by users you follow?
@eminisrafil
@eminisrafil 6 лет назад
Thank you keep it up! Any hints on when geofiltering will be available? :)
@Fireship
@Fireship 6 лет назад
I don't know, but I hope to see geo query support soon. You can expect a video as soon as it becomes available.
@NikosKatsikanis
@NikosKatsikanis 4 года назад
Does it work the same way in Datastore in google cloud?
@ollerandres
@ollerandres 6 лет назад
Hi Jeff, wondering if it is better using userId as the "Document ID" for "tweets" and any other collection related to the user. This way you can use: /user/{userId} to show user information /tweets/{userId} to list every users' tweets /following/{userId} to list every followed user /followed/{userId} to list every user following the user
@edmundo096
@edmundo096 5 лет назад
I don't think so. This *may* be more appropriate to be applied on a server endpoint than on firebase. I have little to no experience here but it feels better to use the /model/{modelId} most if not all the times so you can always retrieve unique documents.
@tristanheilman3967
@tristanheilman3967 4 года назад
At 6:12 it is stated that we can return tweets by multiple users and then at 6:20 it is stated that we can also scope a query to a specific user. My question is... is it possible to scope the query to multiple users (a friend list), lets say an array or user ID's?
@tyleradleta9321
@tyleradleta9321 4 года назад
I am also curious
@whatthefunction9140
@whatthefunction9140 3 года назад
Does the size of my db change the response time? Or has Google abstracted it enough to not make a difference?
@kamalkamals
@kamalkamals 6 лет назад
I remember we use this technique with Firebase Realtime Database before Firestore and i can't see any news except modification on query code, any way thank you a lot for your tutorials.
@Fireship
@Fireship 6 лет назад
The query methods are a big improvement + it gives you the flexibility for shallow queries when nesting. Thanks for the feedback :)
@kenjihikmatullah1060
@kenjihikmatullah1060 4 года назад
Nice explanation
@nxone9903
@nxone9903 2 года назад
NoSQL feels so primitive compared to relational dbs. I quite like its simplicity but do feel uneasy by the lack of relations
@gamingfirst0tv
@gamingfirst0tv 5 лет назад
Do you know of any technique to reduce the number of document reads when querying a collection of posts? currently working on an app and it seems wasteful that just strolling through a paginated profile of a user can cause upwards of 100 reads when you have many posts.
@zakariaarrim5493
@zakariaarrim5493 3 года назад
Thank you so much bro I was lost
@farishmd2241
@farishmd2241 Год назад
I am so surprised that this is the same way that i was thinkink to use firestore database😁
@Neerajkumar-xl9kx
@Neerajkumar-xl9kx Год назад
Wow loved it
@avinashmphp
@avinashmphp 6 лет назад
Great tutorial! Can you please post a tutorial for 2 cascade dropdown list with array object thank you very much
@elvisfernandes4157
@elvisfernandes4157 6 лет назад
I thought you'd demonstrate the use of 'reference' field type... any thoughts on that? Keep up the great work! :)
@cucco1
@cucco1 6 лет назад
My thoughts exactly.
@lilililliilil
@lilililliilil 6 лет назад
Is there any ways to check the size of the document?
@Manish-fm5iv
@Manish-fm5iv 6 лет назад
So how would you get a list of tweets a user hearted?
@SquishySwishy
@SquishySwishy 4 года назад
Query through the 'hearts' document where userID == desiredUser
@qazyhn94
@qazyhn94 5 лет назад
great video
@JoeTechster
@JoeTechster 3 месяца назад
Amazing!!
@drisscriss6479
@drisscriss6479 Год назад
Is you??😳 5 yrs back ur voice 🤐🔥❤️
@codinginflow
@codinginflow 6 лет назад
RU-vid recommends me this video while I am working on a Firestore implementation in Android. I wonder if they can view my PC.
@TheEnde124
@TheEnde124 4 года назад
Yes, yes they can
@codinginflow
@codinginflow 4 года назад
@Wafi Hartono Yes, it's me
@SunsetRacer
@SunsetRacer 6 лет назад
Very good job explaining this. but one thing for sure it doesn't need to be in 9 mins
@ray-lee
@ray-lee 3 года назад
does this create lot of document read and the cost will be pricey
@chicagoboy279
@chicagoboy279 5 лет назад
I dont get, that wont scale if you assign ID manually
@HaiNguyen-cf1ji
@HaiNguyen-cf1ji 5 лет назад
Can firebase auto generate object id (let say userID) for me, or i have to type it down manually. I know that firebase can create the key ID but how can i get that ID and put it in other object?
@user72974
@user72974 5 лет назад
If it doesn't, you have access to free libraries in all popular programming languages to generate UUIDs. Your client, whether that's a web browser or server, can create the UUID and include it as the new document's ID as it creates the document in Firestore. Example: www.npmjs.com/package/uuid
@shiftEscape
@shiftEscape 6 лет назад
Great video! Keep it up! :)
@Fireship
@Fireship 6 лет назад
+Alvin Will do, thank you!
@Luggruff
@Luggruff Год назад
So, if I am creating a quiz app, and I in the end want to query what the average score of ALL users are, I basically have to have my questions as a root document, and add users ID's to each questions answer as an array? I.e. Question 1 > Option A > User 1, User 2, User 3. Then Question 1 > Option B > User 4, User 10, User 101. Then Question 2 > Option C > User 1, User 3, User 101. Or am I missing the point here? Really struggling with how to design a database where I can store users answers to the questions, but not only that, storing which question each user bookmarked for later review, and also make it possible for users to see statistics per chapter, counts of bookmarks per chapter/total questions, correct answers per chapter/total questions etc.
@muhdzulfadhlee
@muhdzulfadhlee 5 лет назад
const ref = db.collection('assign'); ref.where( 'email', '==', user.email ) How to compare assign.email and user.email in this case ? I want user.email to become a variable that changes from user to user that will display only the email that match.
@rachitkumarsingh3228
@rachitkumarsingh3228 Год назад
new to firebase..... dose it increase read and write count...or increase billing
@RumakInaph
@RumakInaph 6 лет назад
What if a user changes profile pic, so when loading the tweets, for each tweet we have to make a query to the user collection to get the profile pic? If I am pulling 50 tweets, I will potentially make 50 additional queries to fetch users later username and profile pic with the current Firestore limitations. Any efficient way of achieving this?
@Fireship
@Fireship 6 лет назад
Yes, save the current profile pic with a static predictible path like "/avatars/userxyz/avatar.png". That way you can override the file source and its still updated everywhere.
@RumakInaph
@RumakInaph 6 лет назад
good idea, I can just store the image with the same name on may be cloud storage... for fetching the latest name and username, we should still query 50 times right? this will be an issue with any kind of social networking apps where historical data is shown and a user can change their name/username.
@mohamedyoussef8835
@mohamedyoussef8835 Год назад
Awesome video +++++++++++++ 😃
@muhammadafzal237
@muhammadafzal237 2 года назад
I am working on a project where videos will be displayed and users will be able to comment on videos. How will be the relational database for it on firestore.
@raisshaikh259
@raisshaikh259 6 лет назад
amazing
@raphaelabadie2518
@raphaelabadie2518 4 года назад
@Fireship why not putting hearts collections under each user ? With and object {tweetId1 : true, tweetId558: true}. I would kindly like to know if this can cause issue or not ? Because liked tweets are linked to the users, so creating a collections under users/${userId} make sense no ? Instead of having it outside create the need to link it. And has you said even if the collections is big it's not a problem (if the user like tons of tweets should not be an issue). Cloud functions triggered where like or unlike will work the same for total count.
@akshattamrakar9071
@akshattamrakar9071 5 лет назад
At 8:03 you said "at episode 63" which video is it
@LV-md6lb
@LV-md6lb 5 лет назад
No offense but it seems like you are not even interested as he's showing a browser screen with a clear URL address that links to the episode in question: angularfirebase.com/lessons/firestore-cloud-functions-data-aggregation/
@mattanderson2840
@mattanderson2840 2 года назад
Can someone link me the video that is episode 63 that is referenced please :)
@SampathLokuge
@SampathLokuge 6 лет назад
Hi, I just purchased Pro membership. But I cannot see member login section on your site? But I can access Pro member content. Could you tell me how that happened?
@Fireship
@Fireship 6 лет назад
Yes, you can find the link to manage your tinypass account at angularfirebase.com/dashboard - sorry, it's a weird setup currently
@SampathLokuge
@SampathLokuge 6 лет назад
Yes, I saw that. Could you explain how that site's login gives me the permission to use "angularfirebase.com"?
@Fireship
@Fireship 6 лет назад
After authenticating it allows restricted content to be accessed with limits or locks.
@Fireship
@Fireship 6 лет назад
Let's chat on Slack if you're interested in talking code :)
@SampathLokuge
@SampathLokuge 6 лет назад
Hmm... Yes, Sure thing :) Thanks for nice and most wanted video series for me.
@SachalChandio
@SachalChandio 2 года назад
you are awesome
@SiddharthRay1
@SiddharthRay1 6 лет назад
I am not getting how to reach out to you on slack
@TheGrafox
@TheGrafox 6 лет назад
Thanks ... Most cases is shopping cart ... Can you make structure and queries for that in the future ... Thanks again
@Fireship
@Fireship 6 лет назад
Yes, I have a shopping cart structure planned for a pro video in a few days on angularfirebase.com
Далее
Firebase - Back to the Basics
25:23
Просмотров 582 тыс.
⚡️Uylanishim kerak, sovchilikka borasizmi?...😅
00:50
Yeni Özbək Mahnisi Yoxsa Vefali Reqsi? 😍
00:36
Просмотров 1,8 млн
Data Modeling with MongoDB
34:56
Просмотров 106 тыс.
100 Firebase Tips, Tricks, and Screw-ups
24:31
Просмотров 185 тыс.
Which Is Better? SQL vs NoSQL
9:43
Просмотров 281 тыс.
Cloud Firestore Data Modeling (Google I/O'19)
40:37
Просмотров 171 тыс.
I tried 5 Firebase alternatives
10:31
Просмотров 764 тыс.
7 Database Paradigms
9:53
Просмотров 1,5 млн
Firebase has SQL: Introducing Data Connect
16:29
Просмотров 57 тыс.
Faster Firestore via Data Aggregation
9:28
Просмотров 61 тыс.
The Secret Sauce Behind NoSQL: LSM Tree
7:35
Просмотров 193 тыс.
iPhone перегрелся, что делать?!
1:01
Choose a phone for your mom
0:20
Просмотров 5 млн