【发布时间】:2020-12-22 03:34:50
【问题描述】:
如何单独编写文档 ID 而不是完整路径?目前我的代码正在插入users/pdqr4LyHzbuGle0e8sCr。我宁愿它插入pdqr4LyHzbuGle0e8sCr。
var collUsersRef: CollectionReference = db.collection("users")
val doc = collUsersRef.document()
var data: HashMap<String, Any> = hashMapOf(
"docID" to doc
, "email" to email
, "username" to user
, "createDate" to FieldValue.serverTimestamp()
, "modifiedDate" to FieldValue.serverTimestamp()
, "stat" to 1
)
doc.set(data)
【问题讨论】:
-
建议你澄清这个问题。该代码没有明确提及任何“文档 ID”。
标签: android firebase kotlin google-cloud-firestore