Firestore文档未创建或更新数据
admin.initializeApp();
let db = admin.firestore()
let user = db.collection('users').doc(userId);
let data = {
timestamp: FieldValue.serverTimestamp(),
bounties : {
[impressionId] : {
timestamp: timestamp,
amount: amount,
currency: currency
}
}
};
user.set(data, {merge: true});
以下示例数据应用于创建或更新Cloud Firestore文档
{
"example-user-1": {
"bounties": {
"example-impression-1": {
"timestamp": "12315443",
"amount": 0.0,
"currency": "null"
}
}
}
}
未创建文档
答案 0 :(得分:0)
安装此库并添加此代码后,它可以工作!但我不知道为什么。
list.setOnItemLongClickListener(new OnItemLongClickListener() { //list is my listView
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
final int pos, long id) {
//Whatever you wanna do
ClipboardManager clipboard = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(label, text);
clipboard.setPrimaryClip(clip);
}
});
答案 1 :(得分:0)
user.set(data, {merge: true}).then(data=>{console.log(data)});