firebasegoogle-cloud-firestorefirebase-security

Firestore Rules - Datatype Validation


I've read multiple questions in Stack Overflow and the documentation but I couldn't find multiple validations that I can imagine that exist.

Per example, it is possible to check if request.resource.data.description is string but can is it possible to do the same when it comes to number, float, timestamp or even array/list? I couldn't even find the string one in the documentation so I can imagine it is missing more than just that one.


Solution

  • You might want to watch my video on data types in Firebase security rules. In it, I list all the different data types that you can check:

    value is bool
    value is int
    value is float
    value is number
    value is string
    
    value is list
    value is map
    
    value is timestamp
    value is duration
    value is path
    value is latlng