Firebase Database Get issue

Hello,

I am currently having an issue/roadblock using the Scott Firebase Database plugin. The question is, how can i get only the value of a field located in the firebase database. example:  If i write to the database…

local totalCoins = 5 firebaseDatabase.set(firebaseAuth.getUID(), {coins = totalCoins}, function (event) if(event.isError) then native.showAlert( "Error", event.error , {"Ok"} ) end end)

The info above writes great to firebase database and shows “coins = 5” online.

When i use the following information to Get the number/value of coins, nothing happens

firebaseDatabase.get(firebaseAuth.getUID(), function (ev) if(ev.isError) then native.showAlert( "Could not Get Data", ev.error , {"Ok"} ) else native.showAlert( "Data received", json.encode( ev.coins ) , {"Ok"} ) end end)

I need a way to only “get” the number of coins from the firebase database. 

Any help would be greatly appreciated! 

ev.coins is not a table it is a key for a value. you should just do

native.showAlert( "Data received", json.encode(ev) , {"Ok"} )

Thanks scott, and how would I call to get only the value of coins?

ex: just the amount of 5 

print(ev.coins)

It is very weird. I am still not getting ONLY the number value of coins from firebase. 

If i have the below structure in database…

databaselocation - 40fmllseo394rgs2459(UID) coins: 5

how can i show only the value of coins to a user through text?

need something like this but it does not work…

  1. firebaseDatabase.get(firebaseAuth.getUID(), function (ev)

  2.    if(ev.isError) then

  3.      native.showAlert( “Could not Get Data”, ev.error , {“Ok”} )

  4.    else

  5.      local totalCoins = json.encode( ev.coins )

  6. end

  7. end)

    local coinTotal= display.newText( "Coins: "…totalCoins, 130, 130, “LeagueGothic”, 30 ) coinTotal:setTextColor( 255/255, 255/255, 255/255 ) sceneGroup:insert( coinTotal )

Please file a bug report

https://docs.google.com/forms/d/e/1FAIpQLSf-V3z-V3FZ5y9Sb19cxVfjx7fSRV9HIbpAGptN7DaY3Ki_DA/viewform?usp=send_form

my bad it should be

firebaseDatabase.get(firebaseAuth.getUID(), function (ev) if(ev.isError) then native.showAlert( "Could not Get Data", ev.error , {"Ok"} ) else native.showAlert( "Data received", ev.data.coins , {"Ok"} ) end end)

Thank you so much for the support Scott!