Marketplace
>
limitChildDocs
firestore

limitChildDocs

v
0.0.1
Latest Version
Likes
0
Installations
0
Views
0
3

Overview

Limit the number of documents to a specified maximum count in a specified Firestore collection.

Usage

### How this function works Use this function to control the maximum number of documents stored in a Firestore collection. If the number of documents in your specified Firestore collection exceeds the specified max count, this function deletes the oldest documents first until the max number of documents allowed remains. Each document you create must have a `_createdAt` field of type **timestamp** in order to be tracked and sorted. From this creation date that the document has, the function selects which one has to be deleted so that the maximum you determined is maintained. ### Prerequisites - You must have previous knowledge of **Firestore**. ### Function details In order to complete the installation process, you must add the required info to the form: - **Document Path**: The document path that you'd like this function to listen to. A placeholder should be used for the document ID (e.g., /collection/{docId}). - **MAX_COUNT**: The maximum count of docs to keep in your specified Firestore collection. > Note that the oldest documents will be deleted first to maintain the number specified in MAX_COUNT.
Cost
FREE
Cost
Version
0.0.1
Language
JAVASCRIPT
Created At
Updated At
Workspace
firestore
Tags
firestore
limit
docs
© 2023 Function Store