Тёмный

Firestore Data Modeling - Five Cool Techniques 

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

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

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 153   
@void4904
@void4904 3 года назад
1:32 array -contains 2:47 AND, OR, NOT - feat. TAG 5:04 composite strings - feat. Commets 7:33 Query an Array of IDs 8:48 duplication -feat. Follow
@cameronmccoy2204
@cameronmccoy2204 3 месяца назад
😊
@MYMPSWORLD
@MYMPSWORLD 5 лет назад
That last social networking problem is a seriously complex one when deleting, editing posts come into the picture. A simple database won't be enough. I recommend going to Big data if you have thousands of active users/active requests at any moment of time. Even if you have less load then that, I recommend using other services in conjunction like message broadcasting, caching, defer db writes, batch writes etc. This may sound like a lot of work for a single feature but trust me, when you scale, it will save you a hell lot of troubles.
@reggieeditz
@reggieeditz Год назад
AWS Amplify?
@pawekoaczynski4505
@pawekoaczynski4505 3 года назад
It took me about half an hour to understand those last few minutes, but thanks to that I got a better understanding of Firebase
@ShinnKQ
@ShinnKQ Год назад
The query an Array of IDs is just what I need. Thank you.
@devcaio
@devcaio 5 лет назад
Awesome video! That topic is really important, I wish we had more content like this.
@TimeoutMegagameplays
@TimeoutMegagameplays 5 лет назад
You have read my mind, I was just scratching my head trying to do some data modeling.
@MM-ts9jy
@MM-ts9jy 2 года назад
Excelent explanation, I now understand everything. Deep down the true answer is: don't use non-relational databases.
@reactmagic2348
@reactmagic2348 2 года назад
The problem is in real world application development, requirements change constantly and it’s impossible to accurately plan ahead. In these cases, if you had chosen to use NoSQL you’re going to be pretty screwed because your firestore model won’t work as soon as the requirements change. On the other hand, if you used SQL you can just easily add a new relation. I think it’s a little misleading to frame firestore as a good idea for application development when most data models can’t be entirely planned for up front
@goldfish8196
@goldfish8196 2 года назад
LOL. Loved the footage in the beginning, where the guy is stress out .MAGICAL
@AbdallaElmedny
@AbdallaElmedny 4 года назад
The composite strings were super useful! Thank you so much!!!!
@ResoCoder
@ResoCoder 5 лет назад
At 6:55 I wanted to call the spelling police but you've corrected yourself. Great tutorial Jeff!
@Fireship
@Fireship 5 лет назад
Haha, it wasn't too severe to rerecord, but I knew somebody would notice
@joshblf
@joshblf 4 года назад
had to watch this at 0.75x speed to make it sound like it wasn't playing at 1.5x speed
@geoffreyschuchardt5350
@geoffreyschuchardt5350 2 года назад
This is how I stomach any of these videos
@sigma_z
@sigma_z Год назад
Where as all other videos on RU-vid you can play at 2x speed, here you have to slow down. Bravo to this educator who’s really good at delivering value.
@Ciencia_con_s
@Ciencia_con_s Год назад
lol 😂 being a mexican but still listening at 1x... Can you do the same with spanish, hdlv? 😂
@nadeemkh100
@nadeemkh100 3 месяца назад
All his videos like this 😢
@FilledStacks
@FilledStacks 5 лет назад
Awesome video. Love the clarity and getting straight to the point. I need to up my game to get my videos shorter and to the point faster :) Thanks for the video.
@grahambodie7429
@grahambodie7429 3 года назад
You prolly dont care but does anyone know a method to get back into an instagram account..? I somehow forgot the password. I appreciate any help you can offer me.
@victordiego7791
@victordiego7791 3 года назад
@Graham Bodie Instablaster ;)
@grahambodie7429
@grahambodie7429 3 года назад
@Victor Diego i really appreciate your reply. I got to the site thru google and Im waiting for the hacking stuff atm. Seems to take a while so I will reply here later with my results.
@grahambodie7429
@grahambodie7429 3 года назад
@Victor Diego it worked and I actually got access to my account again. I am so happy:D Thanks so much you really help me out!
@victordiego7791
@victordiego7791 3 года назад
@Graham Bodie glad I could help :D
@xolanimaphumulo6820
@xolanimaphumulo6820 6 месяцев назад
On the composite strings , you will quickly run into the field value limit of 1MiB
@someonlinevideos
@someonlinevideos 5 лет назад
@fireship hey Jeff, best video I’ve seen yet on modeling data with Firestore. No nonsense with real world and code examples. Excellent! One quick sanity check: was this created before collectionGroup queries were announced? It seems like at least #5 would be solvable using one. Just checking. Thanks!
@deanjackson3238
@deanjackson3238 2 года назад
Thanks for the cool video ! At 8:30 there is a noise in background, I though it was my baby crying in the babyphone lol
@MashaoleMogale
@MashaoleMogale 2 года назад
the best database for internet of things data
@hx9
@hx9 3 года назад
I'm confused. Isn't this just 5 ways to create the features of a relational database in a non-relational database? Is speed the only reason to use a NoSQL database then? I feel like as a Jr. Developer I could have solved all these things very easily, possibly in less lines of code, using SQL. Looking for guidance.
@groebestie5594
@groebestie5594 2 года назад
I guess it only looks this way because you are looking from the perspective of a RDBMS user. Relational data is easy with SQL if you allow joins. These DBs are made for storing relations between data. Document DBs are way simpler. For me document based DBs really shine in the one db query per application screen use case which makes it super easy to fetch all the data you need in one go without thinking too much about Object Relational Mapping and Joins. This makes it easy for application development because you define your db documents to fit your application and not define the db structure separate from your application. This gives you a lot of flexibility and might save dev time because you don’t have to think about strict schemas. Personally I like to think of it similar to typed vs. untyped languages. One is more flexible and you might accidentally shoot yourself in the foot with stupid errors the type system would have found, the other gives you more safety but you might build too many abstractions just too satisfy your type system and now everything is more complicated.
@saarikivit
@saarikivit 5 лет назад
For the 4th question: admin.firestore().getAll(...docRefs) Works at least on the firebase-admin library.
@Fireship
@Fireship 5 лет назад
That is a good point, thank you!
@mawulijo
@mawulijo 5 лет назад
Inspiration inspiration inspiration. Glad to know you Jeff Fireship
@narcodico
@narcodico 5 лет назад
Jeff Fireship =))) wow! That's a pirate name if I ever heard one!
@mobileappvids9616
@mobileappvids9616 2 года назад
Excellent techniques.
@fire_boat
@fire_boat 4 года назад
"in" operator is really helpful
@HassanMalikTW
@HassanMalikTW 5 лет назад
Lots of love from pakistan
@user-qq7yc1qp8z
@user-qq7yc1qp8z 4 года назад
What is a better way to organize data in firestore in my case? A list of individual small entrepreneurs (like haircutter, manicurist, beautician, etc). Each has personal info (geolocation, skills), a list of services with pricing, and a dynamic schedule, that updates when somebody books the time. I guess it's a simple structure, but I don't have experience in firestore and in any backend things, and just don't want to shoot myself in the foot
@jhoanmartinezsilva2609
@jhoanmartinezsilva2609 3 года назад
I am sorry, i gnored your vids from youtube recomendations, its amazing your content
@miguelfuertes4004
@miguelfuertes4004 5 лет назад
Beginner here, is the course about firebase or more about nosql databases?
@Fireship
@Fireship 5 лет назад
It's about firestore specifically. There are some paralells to mongodb tho.
@miguelfuertes4004
@miguelfuertes4004 5 лет назад
@@Fireship thanks
@AndrewErwin73
@AndrewErwin73 5 лет назад
Relational database + ORM = happiness
@vasiovasio
@vasiovasio 4 года назад
MySQL for Life!
@martonkardos8094
@martonkardos8094 2 года назад
Not really scalable though :( I heard it was pretty slow once your queries become complicated enough
@joonaskali2337
@joonaskali2337 2 года назад
@@martonkardos8094 prolly, but I doubt the usual hobbyist/small bussines will hit that ceiling
@martonkardos8094
@martonkardos8094 2 года назад
@@joonaskali2337 yeah sure thing, I mean I never hit it personally, just heard it from a friend who was working for a large company
@WatchLionProductions
@WatchLionProductions 5 лет назад
Awesome video! Fluid and clear explanation 👌
@victornweze7230
@victornweze7230 5 лет назад
Nice one
@radezzientertainment501
@radezzientertainment501 Год назад
lovely tips
@devcaio
@devcaio 5 лет назад
What is the best way to cache a complex query in Firestore? Lets say I have a query that read hundreds of document to compute a value and I want to cache it for a certain time to reduce costs and improve performance, whats the best way to do it?
@Fireship
@Fireship 5 лет назад
If you have a computed value, like a user's lifetime game points or something, you can use cloud functions to aggregate the value to a single doc.
@MYMPSWORLD
@MYMPSWORLD 5 лет назад
You can use in-memory cache services like redis, elasticcahce etc. If you are using any API Gateway, they usually have the feature for caching API responses for certain amount of time. Eg. All API requests to a particular url with same params can be cached for 5 mins.
@AbhishekKumar-mq1tt
@AbhishekKumar-mq1tt 5 лет назад
Thank u for this awesome video
@andreip.8321
@andreip.8321 3 года назад
I like your YT tutorials and I was considering subscribing to pro, the Lifetime option. I have a question though, and I didn't find any way to contact you through the site.. that kinda makes me think twice about this move, but anyway... hopefully it will be easier to reach you as a pro member. My question is, as a Lifetime member, will that include any (possible) new courses that you might add? That's a pretty important point you might add to the Lifetime benefits. Thanks
@marcinswierzowski368
@marcinswierzowski368 5 лет назад
I am curious what vscode theme are you using? I have looked through a bunch of your videos but it hasn't been mentioned anywhere.
@selfhosted918
@selfhosted918 5 лет назад
It looks just like mine, "One Dark Pro" - Ironically the color scheme used in Atom.
@bakalomio2033
@bakalomio2033 5 лет назад
+1 for "It's Always Sunny in Philadelphia" =)
@highrankin
@highrankin 2 года назад
On the first technique, 'array-contains', would this still be a good option if you have say, 100,000 posts or some giant amount of potential posts?
@mossasameer3338
@mossasameer3338 3 года назад
could you do a video in how to use firestore converter in good way? love ur videos :)
@GhulamMuhiaudin
@GhulamMuhiaudin 4 года назад
Hey there, I am new in app development. Do your courses also provide QA Support?
@kmcat
@kmcat 5 лет назад
around 5:24. Cloud you use the reference type instead, that way you would get all the presents
@Fireship
@Fireship 5 лет назад
That would work if they were nested in subcollections, but all the docs are in the same root collection in this case, so they can be read with a single query.
@zacharythatcher7328
@zacharythatcher7328 3 года назад
“We can run these concurrently” is easy to say as a JavaScript dev, as most of your packages are written with async built in. In python, is it safe to thread multiple get requests to the same docs? (Since google packages are blocking in async, but not threads blocking)
@sooryasankar1193
@sooryasankar1193 4 года назад
The feed data model is awesome. But what if the fields are going to update frequently? like updating like count, view count, number of comments for that particular post? how to handle this situation?
@fernandoluis53
@fernandoluis53 4 года назад
Why aren't you udemy? I was looking for this course for over a year...
@wave641
@wave641 5 лет назад
Hey Jeff, what do you animate videos with? These are the highest quality programming videos I've seen on youtube.
@ErayTonyali
@ErayTonyali 5 лет назад
Hey Aaron, there's a video named "Behind the Scenes: How I make the Videos" from Jeff. I think he explains everything over there. Check it out from his channel. If you are asking for the tools, check out "7 Amazing Developer Tools that you're not using yet" from Jeff as well. Good luck!
@Snailsxd
@Snailsxd 5 лет назад
discord: *exists* Fireship: *Guess I'll use slack*
@nickstylezmedia
@nickstylezmedia 5 лет назад
Yeah I'd be really nice if there was a Discord community dedicated to Fireship.io
@Fireship
@Fireship 5 лет назад
I am considering it. Slack is already established, so migrating might be hard.
@emericgnonhoue7029
@emericgnonhoue7029 5 лет назад
Nice
@chind0na
@chind0na Год назад
@fireahip. Now how to model data for Appwrite. We don’t have joins. We’re told 1) to make two or more calls and transpose value in the client side or 2)use an aggregation cloud function that merges all relevant data in one big table. Option 2 sounds redundant.
@mika_chu
@mika_chu 3 года назад
Is "Firestore Data Modeling" course suitable for iOS development?
@alexwchenpro
@alexwchenpro 5 лет назад
Thank you for the amazing work!!! more video like this please :D
@MrUNhelp
@MrUNhelp Год назад
At 8:31 : Isn't it a better idea to do one get with a where condition, to have only one get (and maybe one read request) instead of multiple (here 3 ) ?
@johnnycopes
@johnnycopes 9 месяцев назад
It's possible to do a WHERE query with the IN operator, but this has a hard limit of 30 items in the comparison array (documentation: firebase.google.com/docs/firestore/query-data/queries#in_not-in_and_array-contains-any). But using the example in the video, I think the idea is that reading 3 documents is preferable to reading all documents and then still having to find the relevant documents in the client-side code.
@darudeSandstorm.
@darudeSandstorm. 5 лет назад
Once you have duplicated data, how do you make sure that it is updated correctly, everywhere in the db?
@MaulikParmar210
@MaulikParmar210 4 года назад
Since no one has answered it yet, here you go: That's a bad db design, sql or not. You instead embed document id to refrence same data over all references just like foreign keys. Only thing about no sql is, the data structure of document is not predefined and can have various data. But you can always use best practices from other data modelling and apply it here to make life easier.
@marcosraul4132
@marcosraul4132 4 года назад
@@MaulikParmar210 not really, check the google documentation, it's best practice to duplicate a portion of the data so u would only need one query to access the information, modern databases are optimized for reads since they occur 1000s of times more often than writes. However, everything comes with tradeoffs, you would need to update every place when you are making a change, nothing is perfect.
@MaulikParmar210
@MaulikParmar210 4 года назад
@@marcosraul4132 excuse me but google isnt the only data store vendor in market. And whole point is there are trade-offs between different design patterns and one can only understand it if they have implemented it in first place. Well there are also ACID compliant data stores available where you really do not need to duplicate data for high availability. Thus if you need to, you are likely compromising on some factor. Either om technology level or standard practice level. And it has nothing to do with Google's bigtable, any other traditional or widecolumn datastore they use. DHL produces about 1TB of consignment data daily and still returns any query within 300ms in distributed cluster across multiple regions, ever wondered why? Plus they don't duplicate that much data, considering the volume! Ofc there are multiple examples like these but people should get the point that there are problem specific solutions rather than solutions that solves general problems(because they are specific!) when it comes to big data.
@marcosraul4132
@marcosraul4132 4 года назад
@@MaulikParmar210 i agree with u that there are always tradeoffs, however, since this is a google product, designed, maintained, and used extensively by google, their documentation should be your main source of truth. If u want to explore with other architectures for firestore, u would end up repeating the learning process that they already went through, to ultimately reach the same conclusion or settle with an underperforming db.
@MaulikParmar210
@MaulikParmar210 4 года назад
@@marcosraul4132 when you scale you stop using firestore, that's simple and more productive at large level. Firestore allows untrained devs and most importantly managed access to datastore. Most devs who use it don't have skilled infrastructure devs or lack in one or other architectural implementations. Simply put they have to migrate at certain thresold if they want to grow. If anyone relies on 3rd party proprietary infrastructure, it's their loss in terms of being vendor locked for lifetime. Since this is google product you are bound to what it does and that is why exactly you should know the alternatives as well if you are serious about future of the software you are building. Source of truth remains same, firestore can't do it doesn't mean others can't and if you need it you have very good reason to explore and build software with industry standards.
@KumarSaptam
@KumarSaptam 2 года назад
Can you please create a firebase v9 migration guide.
@Dan1ell
@Dan1ell 2 года назад
So in 2021, do comments go into a subcollection of their post? Or are comments kept as a seperate top level collection next to posts?
@TimeoutMegagameplays
@TimeoutMegagameplays 5 лет назад
Hey I'm just wondering about duplication, how can we make sure that both documents aways match? I mean if my client is doing things right there should be no problem, though if someone makes a custom web client for my app that ends up using the exposed firebase API I could start to have problems, also, how can I check inside Firebase if data coming from the user is suitable to store? (ex: is not null).
@mmtf
@mmtf 3 года назад
gotta use functions to manage everything or you would write complicated rules and use transactions.
@DarkChasmGamers
@DarkChasmGamers 3 года назад
Use anything besides transactions is a really bad idea.
@djbravo9710
@djbravo9710 3 года назад
Hello, sir. I learn so many things about firebase from you. Currently I'm working on a chat app and I want to show the last activation time of my users so that I can compare wheather they are active or not. I couldn't find a way to achieve this using firestore. Can you please help me??
@albertrenshaw4252
@albertrenshaw4252 3 года назад
The follower solutions seems very unscalable. Wouldn't it cost hundreds of dollars for a user w/ 1m followers to send 10 or so tweets and 40 or so retweets?
@Skia_
@Skia_ 5 лет назад
Nice tutorial mate! I'd like to know whether it's possible to turn your application into N-tier Architecture when relying on Firebase for the backend Is that even a thing?
@Fireship
@Fireship 5 лет назад
I guess it depends on what you mean by N-tier? I view Firebase as a platform that helps follow the multi-tier app pattern by separating your DB, backend, and client libraries.
@bunnihilator
@bunnihilator 3 года назад
How can i query from messages where we have 2 users and i need to get each users as a sender the other as a receiver and then the other user as a sender and the other as a receiver? I would need a where or. Also i could make 2 queries but i need limit combinaned by the both whithout skiping any messages
@bargieMaster
@bargieMaster 4 года назад
Hi, the discount code is not working for me...is there a newer one?
@pragyandas
@pragyandas 3 года назад
#4 is the dataloader pattern, isn't it?
@dolevdo
@dolevdo 3 года назад
more!
@digimbyte
@digimbyte 2 года назад
issue with this setup is that a user cannot be followed by more than ~40k users due to indexing limitations
@sandeepsingh-lf4bk
@sandeepsingh-lf4bk 2 года назад
I wish i could understand all that
@stanleybacklund5614
@stanleybacklund5614 3 года назад
Target is selling a "neon light" version of your logo
@CodingCatDev
@CodingCatDev 5 лет назад
I HAVE to believe that Firestore will one day be able to do Full Text search like Algolia ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-35RlydUf6xo.html, I know Google Cloud Firestore devs say that it is not the right tool and structured correctly. But I think they could duplicate all that data into an engine like Big Query or something live and make it happen. Here is hoping at least 😺
@pawan-td6ff
@pawan-td6ff 4 года назад
Whenever I feel too braggy about my coding skills, I watch your videos to punch my ego on the dick
@debkanchan
@debkanchan 5 лет назад
I'm early. *Anyone wants firePasta*
@vineet_kishore
@vineet_kishore 4 года назад
Query an array of documents.... Can you give the syntax for flutter.... please. Promise.all(reads) ...what is the equivalent in flutter?
@robinlange_
@robinlange_ 4 года назад
Google is your friend... that leads you to StackOverflow. Try this - stackoverflow.com/questions/57889195/analog-of-promise-all-in-dart
@muzohub3951
@muzohub3951 2 года назад
Hi Im trying to convey a requirement to a Developer that is using Firestore as the database for my web project. I need to model the hierarchy of musical instruments. A typical example would be Orchestral beneath which we would have... Brass, String, Woodwind, Percussion beneath String for example we would have... Violin, Viola, Cello, Double Bass Please note, all of the records above would be in the same table. I am more used to SQL databases so the way I would model this would be to have a Parent_ID field in the Instrument table and this field would have the ID of a record in the same table - therefore creating the relationship from Instrument to Instrument Parent The Developer is saying that this isnt the way that he has done it and is suggesting my method is wrong. He is telling me that against each record he would model what all the children are of that record. Any comments would be appreciated.
@jaggyjut
@jaggyjut 4 года назад
very good tutorial but too fast.
@zakariachahboun
@zakariachahboun 4 года назад
The bad things about NoSQL is the limitation of queries! Look at "NewSQL"
@chiggerchug5977
@chiggerchug5977 3 года назад
Referencing this like 2 years later... 8:40
@chiggerchug5977
@chiggerchug5977 3 года назад
I have a document called group, which has a list of user Ids/a collection of user documents (containing user profile pic urls, names, etc) is there any way in realtime to join them? (i.e. inject the user details into the group)
@ricko13
@ricko13 3 года назад
Ok but just making me love relational databases a little more ♥ MySQL ♥
@KyouKo-x7g
@KyouKo-x7g 3 года назад
i have a question, i dont want to use .where("country" , "==" , "United States") i want to use .where("country" , "contains" , "States") can i do that ??? do someone know how to do that ???
@phasaoh4540
@phasaoh4540 3 года назад
You can now use the IN clause in firestore
@mmtf
@mmtf 3 года назад
@@phasaoh4540 I think this person wanted something like a string-contains but that doesn't exist in firebase. 'in' checks if a field is equal to one of the values in the provided array.
@tonyjaradev
@tonyjaradev 3 года назад
Yo say in several of your videos that you cannot look for more than one thing on array contains, now there are methods such as array-contains-any, in, and not-in. You should update your videos. Specially the paid ones ;)
@jaedson-barbosa
@jaedson-barbosa 2 года назад
Meanwhile I'm designing a system where users will have limited data storage by the 1MB of each Firestore record so I won't have to worry about the cost of the system when it scales up.
@yeilmusic
@yeilmusic 4 года назад
love
@WMRamadan
@WMRamadan 4 года назад
Why do you not work at google.
@santacroce2489
@santacroce2489 3 года назад
after 493 months and 39201923 seconds still can't figure out firestore queries and data modeling ...
@nishcp9680
@nishcp9680 4 года назад
Please tell slowly, where are u running?
@yuridigital
@yuridigital 5 лет назад
name oof music used?
@oknaa8526
@oknaa8526 Год назад
1 - like 2 - watch ;)
@mukhtar7200
@mukhtar7200 5 лет назад
Oh yes
@krtirtho
@krtirtho 3 года назад
Do you know the RU-vid video you're currently watching is uploaded by a channel named "SUBSCRIBE"
@tirthaguha
@tirthaguha 7 дней назад
Monotonous drone voice
@georgedicu7397
@georgedicu7397 2 года назад
i do not rec algolia, its expensive.
@LukeryaPereprygova
@LukeryaPereprygova 3 года назад
what was that
@cunningham.s_law
@cunningham.s_law 5 лет назад
> rejex
@yourstepbf
@yourstepbf 3 года назад
8:31 is a baby crying ?
@monsume123
@monsume123 2 года назад
lol why does your voice go up when you end a sentence ? 😆 It's so disturbing, great video though.
@oguzgurkanbilir1368
@oguzgurkanbilir1368 3 года назад
0.75x
@briansunbury
@briansunbury 4 года назад
duck tails
@andrews8725
@andrews8725 5 лет назад
Pepe Silvia
@Fireship
@Fireship 5 лет назад
The man does not exist!
@LarsKniep
@LarsKniep 5 лет назад
first!
@Fireship
@Fireship 5 лет назад
🥇
@AdelonZeta
@AdelonZeta 5 лет назад
You have good content but did you fast forward your audio? It’s too fast to be effective for learning.
@hieptran5553
@hieptran5553 5 лет назад
you can use youtube setting to slow it down bro
@elainee7116
@elainee7116 3 года назад
You speak so fast, I don't have to speed up your video
@i007c
@i007c 3 года назад
this video is so bad.
@gofudgeyourselves9024
@gofudgeyourselves9024 5 лет назад
Fight Milk
@Fireship
@Fireship 5 лет назад
For bodyguards, by bodyguards
Далее
Cloud Firestore Data Modeling (Google I/O'19)
40:37
Просмотров 173 тыс.
How Many Twins Can You Spot?
00:17
Просмотров 23 млн
ВЫЖИЛ В ДРЕВНЕМ ЕГИПТЕ!
13:09
Просмотров 180 тыс.
I tried 5 Firebase alternatives
10:31
Просмотров 795 тыс.
100 Firebase Tips, Tricks, and Screw-ups
24:31
Просмотров 188 тыс.
JavaScript Pro Tips - Code This, NOT That
12:37
Просмотров 2,5 млн
The Weird History of JavaScript
12:09
Просмотров 1,2 млн