将Redux Saga Firebase自动生成的ID保存到文档字段(document_id)?

时间:2020-06-09 01:12:30

标签: firebase redux google-cloud-firestore redux-saga

我正在使用Redux Saga Firebase(addDocument),它会自动为Cloud Firestore生成文档ID。添加文档后,如何将自动生成的文档ID写入字段document_id

公司传奇:

// Redux Saga Firebase: Add Company Firm (Add Document Will Automatically Generate A Document ID)
yield call(reduxSagaFirebase.firestore.addDocument,
  companiesRef,
  {
    document_id: null,
    company_name: action.company.companyName,
    company_website: action.company.companyWebsite,
    company_phone_number: action.company.companyPhoneNumber,
    company_email: action.company.companyEmail,
    company_street: action.company.companyStreet,
    company_city: action.company.companyCity,
    company_state: action.company.companyState,
    company_county: action.company.companyCounty,
    company_zip_code: action.company.companyZipCode,
    date_created: new Date(),
    date_updated: null,
  }
);

0 个答案:

没有答案