Тёмный

Firestore Sub-Collections 

Chris Esplin
Подписаться 4,5 тыс.
Просмотров 31 тыс.
50% 1

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

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 47   
@StephenRayner
@StephenRayner 4 года назад
2 years later it’s still a problem
@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 :)
@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.
@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 :)
@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.
@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. RU-vid 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 :)
@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.
@oswaldopaez2947
@oswaldopaez2947 6 лет назад
Nice explanation Chris!! I have a question: is there a way to get all subcollections from a document?
@ChristopherEsplin
@ChristopherEsplin 6 лет назад
There's a .getCollections() function on every document. It works great as long as you have a reference to the parent doc.
@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.
@Iamnoone56
@Iamnoone56 4 года назад
Can you tell me please how can i listen for the change in subcollections document??
@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
@williamrichardmendozamacha6761
very very good
@ChrisEsplin
@ChrisEsplin 5 лет назад
Thanks!
@williamrichardmendozamacha6761
@@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 5 лет назад
@@williamrichardmendozamacha6761 Sure thing! Email me at chris at christopheresplin dot com with details.
@williamrichardmendozamacha6761
ok
@eliezerponce1715
@eliezerponce1715 3 года назад
how i can get dynamic subcollections without use the string name?
@SamuelKarani
@SamuelKarani 4 года назад
blinking = false; videoGreat: true;
@skewbcuber3468
@skewbcuber3468 3 года назад
isBlinking: false, madeGreatVideo: true,
@ahmadmohammed1607
@ahmadmohammed1607 4 года назад
Seriously, why did I unsubscribed and subscribed again?
@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 :)
@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???
@drodriguezApps
@drodriguezApps 6 лет назад
use objects
@ChristopherEsplin
@ChristopherEsplin 6 лет назад
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?
Далее
I tried 5 Firebase alternatives
10:31
Просмотров 802 тыс.
Ванька пошел!!!! 🥰
00:18
Просмотров 808 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,2 млн
Cloud Firestore Data Modeling (Google I/O'19)
40:37
Просмотров 173 тыс.
Do we really need firebase in 2023
10:47
Просмотров 125 тыс.
Which Database Model to Choose?
24:38
Просмотров 59 тыс.