This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { | |
"users": { | |
"$user_id": { | |
// email address is required | |
".validate": "newData.hasChildren(['email'])", | |
} | |
}, | |
"emails_to_users": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { | |
// REQUIRED FIELDS | |
"example1" : { | |
"$record": { | |
// foo and bar are required fields that must always exist | |
// this will reject writes to $record, as well as directly to $record/foo or $record/bar if they are null | |
".validate": "newData.hasChildren(['foo', 'bar'])" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyFbRecord(oldRef, newRef) { | |
oldRef.once('value', function(snap) { | |
newRef.set( snap.value(), function(error) { | |
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); } | |
}); | |
}); | |
} |