Peter
Peter

Reputation: 4141

Object types in Firestore?

I have an app with users in a database, like this:

The eye_color element is confusing me, because I want to have a finite selection (i.e. users can never select "red" for eye_color).

Maybe I even want richer content in eye_colors, such as:

That way, in my app, I could render a user's avatar with user.eye_color.hex

What's the proper way to accomplish this?

Thanks!

Upvotes: 0

Views: 355

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317362

Firestore does not have an enumeration type. If there are limits to what values should be in the database, you have to control that on your own. Security rules will help you validate data coming from mobile clients.

Upvotes: 2

Related Questions