更新时间:2023-12-02 22:35:40
snap.data()
返回原始JavaScript对象,其属性包含文档中字段的值.它不包含名为 ref
的属性(除非您有一个文档字段也称为ref).
snap.data()
returns a raw JavaScript object whose properties contain the values of the fields in the document. It does not contain a property called ref
(unless you had a document field also called ref).
如果需要写回已更改的文档,请使用 snap.ref
中提供的DocumentReference类型对象.另请参阅传递给 DocumentSnapshot 类型对象的API文档.功能.
If you need to write back to the document that changed, use the DocumentReference type object provided in snap.ref
. See also the API documentation for the DocumentSnapshot type object passed to the function.
snap.ref.set(...)