javascript - Structurizing data in firebase -


I have recently started using Firebase, however, since I'm not familiar with the NOSQL database, Having trouble doing this.

I am developing a timesheet app, many users can input their start and end hours each day to work, and it will be saved in a database.

At the moment, my firebase structure looks like this:

Http: //imgur.com/tnojU8x

Although there is some problem in accessing this data in my data, I do not think this is right. First of all, I just want to add a new entry under 'TileShit', whenever a user inputs, but obviously I do not want to add 2 entries for a single day to a user.

I know that there are probably some complex ways to prevent the user from doing this, but I think it can be easily settled if I just saw how to make the best database for me Go.

Later in the Loop, for a specific user to show all the days in the current month, every month in his / her closing hours for each day in the month.

UPDATE: I was thinking about denormalizing my database, but could he really help anything?

You should be written by a firebase team.

TL; The DR is that you should denormalize your data, because Firebase is optimized for some types of operations (you do not need to understand the NTT gritty of that optimization in order to fully use Firebase ).

"I am

" I do not want to be able to add 2 entries for one day to a user. "

In fact, there is a denormalization problem; Now with your structure, you can simply examine a path for the space.

New Firebase ('path / per / tileheets / April / '+ Queryet) === blank , where query date is the date you want to check.

If the above If the return is correct, then your user has not submitted the Timesheet. If so, you should not allow them.

"I will start it for a specific user in the current month for every day I want to loop to show in the table all the time that ends in the month. "

You can! When you ask for new firebase (" path / from / April "), with loop through all the nested values ​​underneath the returned object Rotate again.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -