Reputation: 2998
I am probably like many others, who has recently been learning to code in Swift, and was learning to also use Parse as a backend database.
I have recently decided that before launching my app, I want to explore Firebase, and I feel that this may be the better option for my app. Also, as Parse is shutting down it's services, I think this makes most sense.
From what I understand, Parse is a Relational Database, and Firebase is non-relational. And right now, I'm struggling to see how I can build what I already have in Parse, into Firebase.
To breifly explain my Parse set up:
The reviews class simply holds info about films that I have manually added. It also keeps a count against how many people have voted up or down for that particular film.
Votes_Up class is more relational. It records which logged in user is voting up for which film.
As Firebase doesn't seem to have this Table structure but instead uses JSON trees, I'm struggling to work out how I will create my database in Firebase, and still create the same features I currently have. (In where I can show individual users which films they have voted for etc)
Can anyone help and give an example using my current Parse database classes, and how I would structure this in the new Firebase?
Upvotes: 0
Views: 390
Reputation: 1794
To complete the others answers I suggest this structure:
• Film
o CRxIO5xmJ8
DateReleased: "2015-12-29T09:15:50.165Z"
filmName: "Money Monster"
usersVoteFor
cXcofgX0x6gNFOLMLnuq5BnkxV73: true
xxxxxotherUIDfromAuthentication: true
o w5PvtvNT1X
DateReleased: "2015-12-29T09:15:50.165Z"
filmName: "Captain America"
• User
o cXcofgX0x6gNFOLMLnuq5BnkxV73
filmsVotedFor
CRxIO5xmJ8: true
w5PvtvNT1X: true
username: zozo
o xxxxxotherUIDfromAuthentication
username: zaza
Upvotes: 1
Reputation: 11987
As you know the two PaaS platforms are totally different.
Firebase uses a data structure implementation (JSON blobs).
With Firebase they use Web Socket framework to tell you when data has changed. This means Firebase will notify all mobile apps/clients using the private specific key in their JSON that there is new data. Firebase is known to be more "real-time".
What you need is Firebase's Structuring Data Guide
Have you considered using Parse Server?
Upvotes: 0
Reputation: 4843
You probably should consider something like:
users
films
user voted for
reviewers
film voted for
Upvotes: 0