Skip to content Skip to sidebar Skip to footer

When Working With A Copy Of A User In Firebase $$conf Is Added To The Object So I Can't Copy The User To A New Location?

Unless I am accessing a firebase user in an auth callback, the object has $$conf added to it which prevents me from creating a copy of a user profile to move to a new location. Is

Solution 1:

It would be extremely odd to make a copy of a synchronized object. By definition, either the copy would duplicate all the synchronizing methods, or it would be immediately stale and out of date. More likely, you want to store the user ids in your "teams" path and reference the actual data so that it's always up to date.

That said, to make a copy, just call toJSON to remove the $$ methods. Firebase provides a utility for this:

var user = $firebase(...).$asObject();
var userCopy = $firebaseUtils.toJSON(user);
...$set(user.uid, userCopy);

Post a Comment for "When Working With A Copy Of A User In Firebase $$conf Is Added To The Object So I Can't Copy The User To A New Location?"