// Convert specified keys in data to document references based on docRefs object
if (docRefs && typeof docRefs === 'object') {
Object.keys(docRefs).forEach(refKey => {
const refValue = data[refKey];
if (refValue !== null && typeof refValue === 'string' && refValue !== '' && refValue !== 'null') {
// Use the value in docRefs to determine the collection for the document reference
data[refKey] = firestore.doc(
// Convert specified keys in data to document references based on docRefs object
if (docRefs && typeof docRefs === 'object') {
Object.keys(docRefs).forEach(refKey => {
const refValue = data[refKey];
if (refValue !== null && typeof refValue === 'string' && refValue !== '' && refValue !== 'null') {
// Use the value in docRefs to determine the collection for the document reference
data[refKey] = firestore.doc(