[英]How to save previous timestamp to Firebase FireStore
I want to migrate the older data from different system to firestore. 我想将旧数据从不同系统迁移到firestore。
below command saves current timestamp below命令保存当前时间戳
firebase.firestore.FieldValue.serverTimestamp()
I want to store older values, Is there any way available? 我想存储较旧的值,有什么方法可用吗?
firebase.firestore.FieldValue.serverTimestamp()
is a marker value you can use in your code to write the current server-side timestamp into a date field. firebase.firestore.FieldValue.serverTimestamp()
是一个标记值,您可以在代码中将当前服务器端时间戳写入日期字段。 If you want to store another value in a date field, you can specify the value when writing. 如果要在日期字段中存储另一个值,可以在写入时指定该值。
From the Firebase documentation on adding data : 从Firebase文档中添加数据 :
db.collection("data").doc("one").set({
dateField: new Date("December 10, 1815"),
}).then(function() {
console.log("Document successfully written!");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.