You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/firestore/README.md
+38-2Lines changed: 38 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -61,8 +61,6 @@ The schema for one object in the `fieldOverrides` array is as follows. Optional
61
61
62
62
Note that Cloud Firestore document fields can only be indexed in one [mode](https://firebase.google.com/docs/firestore/query-data/index-overview#index_modes), thus a field object cannot contain both the `order` and `arrayConfig` properties.
63
63
64
-
For more information about time-to-live (TTL) policies review the [official documentation](https://cloud.google.com/firestore/docs/ttl).
65
-
66
64
```javascript
67
65
collectionGroup: string // Labeled "Collection ID" in the Firebase console
68
66
fieldPath: string
@@ -72,3 +70,41 @@ For more information about time-to-live (TTL) policies review the [official docu
72
70
order?: string // One of "ASCENDING", "DESCENDING"; excludes arrayConfig property
73
71
arrayConfig?: string // If this parameter used, must be "CONTAINS"; excludes order property
74
72
```
73
+
74
+
#### TTL Policy
75
+
76
+
A TTL policy can be enabled or disabled using the `fieldOverrides` array as it follows:
77
+
78
+
```javascript
79
+
// Optional, disable index single-field collection group indexes
80
+
fieldOverrides: [
81
+
{
82
+
collectionGroup:"posts",
83
+
fieldPath:"ttlField",
84
+
ttl:"true", // Explicitly enable TTL on this Field.
85
+
// Disable indexing so empty the indexes array
86
+
indexes: [],
87
+
},
88
+
];
89
+
```
90
+
91
+
To keep the default indexing in the field and enable a TTL policy:
0 commit comments