Securing specific Document fields in Firestore

2019-05-10 08:35发布

I'm trying to create a simple system that allows users to create an account with info that they provided. Right now, I store all the data in a Collection users which has some Documents that represents users.
I'd like to keep some sensitive data of the user, such as the email address and phone number, private. In Firebase Database I would've created something like this:

  users: {
    uid: {
      public_info:...
      private_info:...
    }
  }

Protecting the data in here is pretty straight forward. I would simply write different rule sets for the private_info and public_info.
How would something like this be achieved in Firestore?

1条回答
劳资没心,怎么记你
2楼-- · 2019-05-10 08:53

Use different top-level collections for user public and private data, and set their rules appropriately.

查看更多
登录 后发表回答