rest - A way to enforce a unique property in Firebase -


in firebase have number of items of data, in case announcements. each announcement has child property of "id", unique every announcement. there way can enforce id unique when post announcements database via rest? is, if tried add announcement same id twice, second 1 fail. suspect can rules, not sure.

thanks, declan

the best way achieve identify each announcement id instead of having child property. can use security rule like:

".write": "!data.exists()" 

if tries write announcement id exists write rule evaluate false , therefore disallowed.

you can use push() method generate unique identifiers chronologically ordered.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -