Firestore Sub-Collections

  Рет қаралды 30,284

Chris Esplin

Chris Esplin

Күн бұрын

What are Firestore Sub-collections???
When should you use them... and more importantly, when should you avoid them?
I bring you the answers!
SMASH THAT LIKE BUTTON!!!1!one
How To Firebase:
howtofirebase....
Glitch.com:
glitch.com/edi...
GitHub:

Пікірлер: 47
@StephenRayner
@StephenRayner 4 жыл бұрын
2 years later it’s still a problem
@codinginflow
@codinginflow 6 жыл бұрын
Well, documents have a 1mb and a 20k field limit and you can't download them partially. Also there is a 1 write per second limit. For a lot of use cases this is not enough, like chat messages.
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
Those are both great use cases for the RTDB.
@rolikaseventysix
@rolikaseventysix 4 жыл бұрын
I keep my code tables in subcollections. I have a collection called code-table, a doc for each code table, for example day, unit, etc. So I can easily retrieve all units by querying 'code-table/unit/*'. The number of entries/docs in subcollections are unlimited, unlike the 1 MB json for nested objects.
@michaeloosthuizen2383
@michaeloosthuizen2383 6 жыл бұрын
Good use-case for sub-collections is data security. They become pretty useful when writing complex rules. Here is an example: Say we want each user to have a user profile that all other users can see, but we want certain things to be private. We can store the private data in a sub-collection and use a security rule to limit access to it. Using this technique you can get quite sophisticated access scenarios achieved, things like dynamically set privacy settings on a social media platform.
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
Yes! I've been using sub-collections recently for private chat rooms, and they're great for easy security. I still try to avoid them... but I've definitely found a few good use cases like this. My problem with sub-collections is that they're easy to misuse. I mean... that's not sub-collections' fault... it's user error. And I mostly hear the stories of user error, so I'm extra-sensitive to it.
@michaeloosthuizen2383
@michaeloosthuizen2383 6 жыл бұрын
Indeed, when you choose to use a sub-collection you had better have a good, well thought out reason for it. Otherwise I would stick to a shallow structures with lots of denormalizing so queries are simpler and quicker.
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
That's exactly right. That is what I should have said in the video :)
@Iamnoone56
@Iamnoone56 4 жыл бұрын
Can you tell me please how can i listen for the change in subcollections document??
@danielborges.
@danielborges. 6 жыл бұрын
I love your vídeos. They are full of good and deep knowledge. Now I will look into your Udemy course. ;) If I may suggest, if you adjust the volume of intro's music similar to that of speech, it will sound better. I have noticed that the muisic is much louder than the speech. KZbin has recommendations for this, which are -13 LUFS. I prefer -23, which is lower. Adobe Premiere has a button that does this automatically in sound effects. Other programs should have as well.
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
I took a crack at adjusting my volume. Let me know if my new videos aren't fixed :)
@oswaldopaez2947
@oswaldopaez2947 5 жыл бұрын
Nice explanation Chris!! I have a question: is there a way to get all subcollections from a document?
@ChristopherEsplin
@ChristopherEsplin 5 жыл бұрын
There's a .getCollections() function on every document. It works great as long as you have a reference to the parent doc.
@alexpov
@alexpov 6 жыл бұрын
So what I your alternative for subcollection? from my perspective they are what make the firebase stand out, ease of data structures and query
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
Totally. Sub-collectiosn work great sometimes, but I prefer embedded objects because I can use them in my security rules and it's often easier.
@SamuelKarani
@SamuelKarani 4 жыл бұрын
blinking = false; videoGreat: true;
@skewbcuber3468
@skewbcuber3468 3 жыл бұрын
isBlinking: false, madeGreatVideo: true,
@MartinMartinez-hj7co
@MartinMartinez-hj7co 6 жыл бұрын
quick feedback watch the camera or put your script on camera level. keep the great work!
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
I've moved to a teleprompter! It's much easier.
@zxcvbn172
@zxcvbn172 4 жыл бұрын
Hello I encountered a problem using the sub-collection, due to this I am unable to progress any further, would you mind taking a look into the problem and provide me a feedback? I have posted the problem is Stack overflow and have yet to received a response. If you do I can provide the link to stackoverflow
@eliezerponce1715
@eliezerponce1715 3 жыл бұрын
how i can get dynamic subcollections without use the string name?
@ahmadmohammed1607
@ahmadmohammed1607 4 жыл бұрын
Seriously, why did I unsubscribed and subscribed again?
@ReesArtist
@ReesArtist 6 жыл бұрын
That was an interesting point of view, and I agree, sub collections are clumsy. But to avoid the problem of orphan sub-collections, I put a boolean description in the document : has_ingredients : True .. this way I know if the sub collection "ingredients" exists or not , and I can query it etc... What do you think of this approach ?
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
Yes! That's what I do too. It's clumsy... but it works!
@ReesArtist
@ReesArtist 6 жыл бұрын
Chris Esplin thanks for your reply ! Great videos btw ! I'm really interested by that Firestore topic, so I'll stay tuned :)
@uidotdev
@uidotdev 6 жыл бұрын
💪
@Seb16291629
@Seb16291629 4 жыл бұрын
I hate firestore . It is so much easier to use express with mongoose
@ChrisEsplin
@ChrisEsplin 4 жыл бұрын
Then why are you watching this video???
@gianellakatherineramirezbr817
@gianellakatherineramirezbr817 5 жыл бұрын
Hi, maybe you could help me. I must make a mobile application for a store that stores users and those must have customer registration, products and sales ... should I use subcollections or could I use only collections at the root level?
@ChrisEsplin
@ChrisEsplin 5 жыл бұрын
Use sub-collections with the new sub-collection group queries. They've really fixed sub-collections by adding group queries.
@gianellakatherineramirezbr817
@gianellakatherineramirezbr817 5 жыл бұрын
@@ChrisEsplin thank you very much :)
@williamrichardmendozamacha6761
@williamrichardmendozamacha6761 4 жыл бұрын
very very good
@ChrisEsplin
@ChrisEsplin 4 жыл бұрын
Thanks!
@williamrichardmendozamacha6761
@williamrichardmendozamacha6761 4 жыл бұрын
@@ChrisEsplin Hi, could you help me? I have a dilemma about how to have data that depends on others, a blog that has many categories and that the blog has many images. Collections (blogs, categories, images) sorry for English
@ChrisEsplin
@ChrisEsplin 4 жыл бұрын
@@williamrichardmendozamacha6761 Sure thing! Email me at chris at christopheresplin dot com with details.
@williamrichardmendozamacha6761
@williamrichardmendozamacha6761 4 жыл бұрын
ok
@drodriguezApps
@drodriguezApps 5 жыл бұрын
use objects
@ChristopherEsplin
@ChristopherEsplin 5 жыл бұрын
I use objects most of the time.
@joseyanez8066
@joseyanez8066 6 жыл бұрын
Amigo para C# puedo hacer eso ??
@ChrisEsplin
@ChrisEsplin 6 жыл бұрын
Yes a new c# SDK... I think.
@joseyanez8066
@joseyanez8066 6 жыл бұрын
Could you make a video explaining?
@ChristopherEsplin
@ChristopherEsplin 6 жыл бұрын
I don't know c# :(
@missilenerodrigues7177
@missilenerodrigues7177 5 жыл бұрын
não funciona erro!! ajuda!
@ChrisEsplin
@ChrisEsplin 5 жыл бұрын
Como? Qual é a problema?
@missilenerodrigues7177
@missilenerodrigues7177 5 жыл бұрын
@@ChrisEsplin fiz conforme o exemplo que tem na descrição do video mais não aparece nada
@missilenerodrigues7177
@missilenerodrigues7177 5 жыл бұрын
firebase firestore versão mais recente!
@ChrisEsplin
@ChrisEsplin 5 жыл бұрын
Você descobriu o problema?
Firestore Setup | To Do App | FlutterFlow for Beginners
6:39
FlutterFlow
Рет қаралды 21 М.
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 32 МЛН
🍉😋 #shorts
00:24
Денис Кукояка
Рет қаралды 3,7 МЛН
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 10 МЛН
Model Relational Data in Firestore NoSQL
9:13
Fireship
Рет қаралды 377 М.
Query Caching | New Feature Tutorial
7:19
FlutterFlow
Рет қаралды 18 М.
How to Structure Your Data | Get to know Cloud Firestore #5
13:57
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Firestore Data Modeling - Five Cool Techniques
11:44
Fireship
Рет қаралды 256 М.
Cloud Firestore Pricing | Get to know Cloud Firestore #3
16:23
Building Scalable Apps with Cloud Firestore (Cloud Next '18)
36:51
Google Cloud Tech
Рет қаралды 9 М.
Subcollections in Firebase/Firestore v9 (with React.js)
22:33
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 32 МЛН