0

I want to store unique user ids provided by Firebase, in my database.

Here is my code:

var uid = result.uid;
console.log(uid);
// Prints the unique user id


// Create User structure in FB
firebase.setValue(
  'Users',
  {uid: true}
);

This creates the following in FB:

Users
  uid: true

uid is simply that, just a string that says uid. Am I doing something incorrect?

(docs for reference)

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734
skwny
  • 2,240
  • 3
  • 21
  • 39

1 Answers1

1

You'll need to use [] accessor to use the value of the uid as a key/property name:

var obj = {};
obj[uid] = true;
firebase.setValue('Users', obj);
Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734