Open Folcon opened 7 years ago
Ok, so having done a little more digging, it seems to be a bug in firebase?
As far as I can work out if you use int keys, it always comes out as an array. So my solution has been to add "key-" as a prefix to my int keys going in, and remove them going out.
Tested what's being returned using it as a double check:
var uid = firebase.database().app.auth().currentUser.uid;
firebase.database().ref('users/' + uid).on('value', function(snapshot) {
console.log("FROM FIREBASE:", snapshot.val());
});
Maybe worth documenting this?
This is actually correct firebase behavior. https://firebase.googleblog.com/2014/04/best-practices-arrays-in-firebase.html?m=1
@flyboarder, been working with this for a bit now and it's going pretty well!
I have noticed an odd issue, it seems that I get different values sending data into the firebase db vs pulling data out.
data goes in:
data comes out:
I'm doing:
It's frustrating as the correct values appear to be being stored in firebase, but the keys in the hash-maps seem to be repeatedly dropped. It seems to be pulling out objects as arrays?
I've tried
js->clj
with and withoutkeywordize-keys
and it doesn't seem to make any difference.Is this an actual bug, or am I just doing something silly?