May 20, 2021 WeChat Mini Program Development Document
Support: small programs, cloud functions, web
Construct a reference to the service-side time. Can be used to query criteria, update field values, or add field values when records are added.
Property | Type | The default | Required | Description |
---|---|---|---|---|
offset | nubmer | Whether | The referenced service-side time offset, in milliseconds, can be positive or negative |
Set the field to service-side time when new records are added:
db.collection('todos').add({
description: 'eat an apple',
createTime: db.serverDate()
})
The update field is one hour after the service side time:
db.collection('todos').doc('my-todo-id').update({
due: db.serverDate({
offset: 60 * 60 * 1000
})
})