base}/documents {
        match /users/{uid} {
          allow read, write: if request.auth != null && request.auth.uid == uid;
        }
      }
    }
    

###  Locked mode

    
    
    // Deny read/write access to all users under any conditions
    service cloud.firestore {
      match /databases/{database}/documents {
        match /{document=**} {
          allow read, write: if false;
        }
      }
    }
    

Before you deploy your Web, Android, or iOS app to production, also take steps
to ensure that only your app clients can access your Cloud Firestore data. See
the [ App Check ](https://firebase.google.com/docs/app-check) documentation.

If you're using one of the server SDKs, use [ Identity and Access Management
(IAM) ](https://cloud.google.com/firestore/docs/security/iam) to secure your
data in Cloud Firestore.

##  Watch a video tutorial

For detailed guidance on getting started with the Cloud Firestore mobile
client libraries, watch one of the following video tutorials:

#####  Web

#####  iOS+

#####  Android

You can find more videos in the Firebase [ YouTube channel
](https://www.youtube.com/firebase) .

##  Next steps

Deepen your knowledge with the following topics:

  * **Codelabs** — Learn to use Cloud Firestore in a real app by following the codelab for [ Android ](https://codelabs.developers.google.com/codelabs/firestore-android) , [ iOS ](https://codelabs.developers.google.com/codelabs/firestore-ios) , or [ Web ](https://codelabs.developers.google.com/codelabs/firestore-web) . 
  * **[ Data model ](/docs/firestore/data-model) ** — Learn more about how data is structured in Cloud Firestore, including hierarchical data and subcollections. 
  * **[ Add data ](/docs/firestore/manage-data/add-data) ** — Learn more about creating and updating data in Cloud Firestore. 
  * **[ Get data ](/docs/firestore/query-data/get-data) ** — Learn more about how to retrieve data. 
  * **[ Perform simple and compound queries ](/docs/firestore/query-data/queries) ** — Learn how to run simple and compound queries. 
  * **[ Order and limit queries ](/docs/firestore/query-data/order-limit-data) ** Learn how to order and limit the data returned by your queries. 

Send feedback

Except as otherwise noted, the content of this page is licensed under the [
Creative Commons Attribution 4.0 License
](https://creativecommons.org/licenses/by/4.0/) , and code samples are
licensed under the [ Apache 2.0 License
](https://www.apache.org/licenses/LICENSE-2.0) . For details, see the [ Google
Developers Site Policies ](https://developers.google.com/site-policies) . Java
is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-04-17 UTC.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing
the information I need" },{ "type": "thumb-down", "id":
"tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{
"type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type":
"thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{
"type": "thumb-down", "id": "otherDown", "label":"Other" }]  [{ "type":
"thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type":
"thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type":
"thumb-up", "id": "otherUp", "label":"Other" }]  Need to tell us more?

  * ###  Learn 

    * [ Guides ](/docs/guides/)
    * [ Reference ](/docs/reference/)
    * [ Samples ](/docs/samples/)
    * [ Libraries ](/docs/libraries/)
    * [ GitHub ](//github.com/firebase/)
  * ###  Stay connected 

    * [ Blog ](//firebase.blog)
    * [ Firebase Summit ](/summit/)
    * [ Twitter ](//twitter.com/Firebase)
    * [ YouTube ](//www.youtube.com/user/Firebase)
  * ###  Support 

    * [ Contact support ](/support/)
    * [ Stack Overflow ](//stackoverflow.com/questions/tagged/firebase)
    * [ Slack community ](//firebase.community/)
    * [ Google group ](//groups.google.com/forum/#!forum/firebase-talk)
    *