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
Post a Comment