ios - Firebase observing object at it's key-path returns it's children one by one -


i'm using firebase ios sdk , i've setup security have each message readable/writeable it's owner. listen message-changes need observe each message @ it's message-key path observeeventtype:(feventtypechildchanged/feventtypechildadded). problem i'm facing here each time message updated/added remotely, firebase return each of children of message (properties name , message) separate snapshot. snapshot-dictionary contain 1 child @ time it's corresponding value. there way have full message returned it's children instead having them returned 1 one ?

-messages   --message_key_a      --name      --message   --message_key_b      --name      --message   --message_key_c      --name      --message   --users     --user_key_a       --name       --messages           --message_key_a           --message_key_c 

you listen value event with:

ref observeeventtype:feventtypevalue withblock:^(fdatasnapshot *snapshot) 

but if each message readable owner, sounds have wrong data model. why don't store messages each owner under node owner:

/messages_per_user     $uid         $messageid             name             message 

that way can give read/write access on /messages_per_user/$uid:

{   "rules": {     "messages_per_user": {       "$uid": {         ".read": "auth.uid == $uid",         ".write": "auth.uid == $uid"       }     }   } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -