How to write a rule to prevent any deletion of node from database

前端 未结 1 1844
终归单人心
终归单人心 2021-02-01 09:45

I am trying to write rules to secure database. But I am confused on writing a rule which will prevent from deleting any node from database. I have read regarding newData.e

相关标签:
1条回答
  • 2021-02-01 10:23

    To allow adding new nodes, but prevent deleting or overwriting any node:

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

    To allow adding and overwriting, but not deleting, any node:

    ".write": "newData.exists()"
    

    Update: screenshot of the simulator for these rules

    0 讨论(0)
提交回复
热议问题