On some accidentally deleted Firebase, I followed the process per below documentation of Firebase on PITR.
To recover a portion of the database, perform a stale read specifying a query-condition or using direct key lookup along with a timestamp in the past, and then write the results back into the live database
let organisationRef: FirebaseFirestore.DocumentReference = admin.firestore().collection(ct.parent_coll_).doc("Y2nZURTmgycxTQ8TnJ")
let readTimestamp = admin.firestore.Timestamp.fromMillis(Date.parse('2024-06-27T16:30:00Z'));
//retrieve places
let searchPlaceQuery = parentRef.collection(ct.place_subcoll_)
.where('api', '==', api).limit(limit);
if (start_id != null) searchPlaceQuery = searchPlaceQuery.where(admin.firestore.FieldPath.documentId(), ">", start_id)
const queryPlaceSnapshot = await firestore_root().runTransaction(
updateFunction => updateFunction.get(searchPlaceQuery),
{ readOnly: true, readTime: readTimestamp }
);
console.log("querySnapshot : " + queryPlaceSnapshot.docs.length);
All data was successfully retrieved at some specific time but i have notice for all that the field, type
array
was missing.
Does it need to be looked up with placeRef as if it was a subcollection?
https://firebase.google.com/docs/firestore/pitr