0

I've been working with Firebase for 1 month, and now I'm starting to understand how it works.

In my App I've got some supermarket products like fruit, vegetable or others.

In real life I've got some NFC tags applied on the products.

In the database, there is a node which contains products, one node which contains NFC Ids, and one node which contains relations between them.

The Product's keys are pushed Ids while the NFC's are their Ids.

With my phone and the embedded NFC reader I can read the tags and tell the system which product I'm scanning.

Now I'd like to create a record each time a phone reads a NFC.

On the record, I'd like to put the data about the phone, the NFC Id's and the Product Push Id.

Is there a Server Side way, maybe with rules, to query the relation between NFC and Products and put it on my new record, the Product Id instead of the relation Id?

In this way I'll cut a lot of Client Side code which is making may app too complicated.

Thanks.

koceeng
  • 2,169
  • 3
  • 16
  • 37
L. Gangemi
  • 3,110
  • 1
  • 22
  • 47
  • What is your database structure exactly? Could you paste some of the exported JSON here. – Rohit Navarathna Mar 30 '17 at 08:48
  • This is not a database structure related question, actually my real JSON is a bit more complicated than how I described it there so I don't think it could help. What I'm asking for is if there is a Server side way to chatch database operation and apply modification – L. Gangemi Mar 30 '17 at 09:05
  • You cannot run any server side code on Firebase. See https://stackoverflow.com/questions/33643147/server-side-calculation-using-firebase. – Rohit Navarathna Mar 30 '17 at 09:13

1 Answers1

4

I have also faced this problem. However, Firebase has introduce Cloud Function a month ago. Try to check the official link out. It allow you to put some logics in server side.

https://firebase.google.com/docs/functions/

I myself haven't done much research on this feature but instead of thinking about the communication as Request and Response you need to see it as Database trigger event.

Is this what you looking for ?

Boonya Kitpitak
  • 3,607
  • 1
  • 30
  • 30