Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
We can move on to inserting the form data into the database will continue working in the register form
component.
At the top of the script, Block will structure the firebase module for the database object.
It's time to end data to the database, the first step for inserting data into the database is to select
a collection.
Let's discuss some terminology.
There are three words you're going to hear me throw around arounds.
You may find these terms used frequently in the documentation.
It's important we take the time to understand what they mean.
The first term is Buckett.
We've already talked about buckets when we created the firebase application.
I want to recap what it is quickly.
A bucket is a physical location where your data is stored.
Firebase allows you to create multiple buckets if you're on a premium plan, you may want to do this
if you want to keep certain data separate.
We don't need that kind of flexibility at the moment.
We can keep everything contained in one bucket.
The second term is collection.
Collections are objects in Firestar.
They give you a way to organize data.
You can think of them as categories.
You don't want your data to get mixed with one another so carelessly.
It's better to organize data in two separate objects.
We'll be able to filter and sort through them.
For example, you can have a user's collection for storing user data.
You can have another collection for blog posts, settings, song uploads, lyrics, et cetera.
Firebase requires you to select a collection before performing any actions on the database you cannot
and data to the database until you choose a collection to add it to the last term is documents.
Documents are the individual records in a collection.
It's the data you stored in the database.
Multiple documents can be stored in a single collection, will be mostly working with documents and
collections in this course.
We're going to select a collection in the firebase file, we could do this in the register form component
file, but we'll be working with the users collection in multiple components.
It's better to export the user collection so that it's accessible in all components below the variable
definitions.
I'm going to create a variable called user's collection.
Its value will be the object returned by the DB collection function.
The DVD collection has one argument, which is the name of the collection to select, we currently don't
have any collections in the database, but that's all right.
The collection doesn't need to exist for Firebase to select it.
We're going to call the collection users.
This function will return an object with methods and properties for working with the user's collection.
The next step is to export this collection.
We'll have access to the users collection in any component, switched back to the register form component
in the import statement for the authentication object.
We're going to change the DB object to the user's collection object.
We only need the users collection object, the purpose of importing the database object was to select
the users collection.
However, we're already doing that inside the firebase file.
It's no longer necessary to have it imported back in the registry function.
We're going to use the user's collection.
We'll call the ad function.
The ADD function will add a document to the collection, a document is the terminology used to describe
an object inside a collection.
The ADD function has one argument, which is the object to insert.
We're going to pass an object with the user data.
We're not going to pass the values object directly to the function.
We don't want to insert the password, confirm password and to US properties to the database.
We can commit these.
The password is already being stored in the authentication section.
The U.S. property was to ensure the user agreed to the terms of service on the front end.
Otherwise they wouldn't be able to submit the form in the first place.
We won't bother storing that type of data in the database.
Let's send the name email age and country properties to the object.
The ad function will return a promise we're going to use async, await syntax to make our code readable,
add the await keyword before the function call.
We'll want to handle the air next Rapti request with a try catch statement.
In the catch statement, we're accepting the error parameter, we're going to use the same code we used
for handling the authentication request, copy and paste the code over to the new catch block.
We're finished by using the ADD function, we're able to insert additional information into the database
it say that we can't typically store in the authentication service.
However, we are storing the email, even though the authentication service already stores it, it's
still handy to store it in the database.
This will allow us to filter and sort through the data by email.
Let's try testing.
If this works, we'll switch over to the browser.
Make sure your developer tools are opened.
We want to check for errors in the console after verifying there aren't errors in the console, fill
out the registration form with valid values.
After submitting the form, we will receive a success message, the council will continue to log the
user's credentials information without a problem.
We'll want to verify if the data is inserted into the database by checking the firebase console in the
firebase console, navigate to the database page, if you already had it opened, then you should see
the data because the database refreshes itself.
If not, try manually refreshing.
The page in the database will find three new columns.
On the left.
We have a list of collections before submitting the request.
There were no collections.
By adding a document to the collection, Firebase will check if the collection exists.
If it doesn't, it'll create it for you.
We didn't have to take care of that ourselves.
In the middle column we have a list of documents in the collection.
Documents are objects in a collection in the right column will find the data stored in a specific document.
You can click on any of the documents to view its data.
This collection is where we'll find the form data we submitted.
All our data is present and accounted for.
If we were to look at the name of the document, it's a random string.
The random string is a generated unique ID for our data.
This is important to understand.
Databases need a way to track each individual record.
This will allow us to pull a specific record or user if we ever need to.
We could have provided an ID ourselves, but Firebase will create one for you if you don't provide what?
We're going to let Firebase take care of assigning IDs for us.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.