Konektor untuk Firestore (baca)
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membaca dari Firestore menggunakan konektor Workflows.
Contoh kode
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],[],[],[],null,["# Connector for Firestore (read)\n\nReads from Firestore using a Workflows connector.\n\nCode sample\n-----------\n\n### YAML\n\n - initialize:\n assign:\n - project: \"myproject123\"\n - collection: \"myEntries\"\n - document: \"Report\"\n - read_item:\n try:\n call: http.get\n args:\n url: ${\"https://firestore.googleapis.com/v1/projects/\"+project+\"/databases/(default)/documents/\"+collection+\"/\"+document}\n auth:\n type: OAuth2\n result: document_value\n except:\n as: e\n steps:\n - is_the_key_found:\n switch:\n - condition: ${e.code == 404}\n next: document_not_found\n - condition: ${e.code == 403}\n next: auth_error\n next: document_found\n - document_not_found:\n return: \"Document not found.\"\n - auth_error:\n return: \"Authentication error.\"\n - document_found:\n return: ${document_value.body.fields.LastName.stringValue}\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=workflows)."]]