Firebase Database Rules - How to emulate if a key within a tree exists, such as hasOwnProperty -


i'm delving firebase security rules firebase realtime database, , i've got tree that's designed this:

the endpoint: /projects/${projectid}

{   "name" : "a fun project",   "users" : {     "zjy846p8q1tgdtlxjdfr9dvvxa53" : {       "role" : "admin"     }   } } 

is there way utilize rules this?

{   "rules": {         "projects": {       "$projectid": {         ".read": "auth !== null && data.child('users').child(auth.uid).key === auth.uid"       }     }   } } 

thanks in advance!

i needed use .haschild(auth.id)

here updated rules:

{   "rules": {         "projects": {       "$projectid": {         ".read": "auth !== null && data.child('users').haschild(auth.uid)"       }     }   } } 

Comments