如何在CloudKit JS中查询元数据? [英] How to query for Metadata in CloudKit JS?
问题描述
我已经弄清楚如何查询某些元数据,例如在我的查询中调用它:
< td>+ record ['created']。value +< / td> < - 填充一些表格数据
但这会回来 undefined 让我感到困惑,因为CloudKit仪表板具有Created By的值(作为使用每条记录创建的自动元数据的一部分。)
如何查询ID / UUID以及以HTML / JS可读方式获取响应?
使用CloudKit获取一个或多个记录后。你会注意到你得到一个看起来像这样的对象:
{
recordName:6E863D3D -5371-4376-A9BA-3B294F480E4E,
recordType:消息,
字段:{
text:{
value:hi ,
类型:STRING
},
},
recordChangeTag:ib461v1s,
已创建:{
timestamp:1434751588720,
userRecordName:_ 36ed4b61e7a11c9302f851fe25a9b911,
deviceID:_ 2
},
已修改:{
timestamp:1434751588720,
userRecordName:_ 36ed4b61e7a11c9302f851fe25a9b911,
deviceID:_ 2
}
}
recordName
是记录的唯一标识符,Object具有创建的
属性,该属性指向具有时间戳
字段的对象。 / p>
I've figured out how to query for some metadata for example calling this in my query:
<td>" + record['created'].value + "</td> <-- populates some table data
But this comes back undefined which confuses me because the CloudKit dashboard has a value for Created By (as part of the automatic Metadata that is created with each record.)
How do I query for the ID/UUID as well as get the response in a HTML/JS-readable manner?
After fetching one or more records with CloudKit.js you'll notice you get back an Object that looks like this:
{
"recordName": "6E863D3D-5371-4376-A9BA-3B294F480E4E",
"recordType": "Message",
"fields": {
"text": {
"value": "hi",
"type": "STRING"
},
},
"recordChangeTag": "ib461v1s",
"created": {
"timestamp": 1434751588720,
"userRecordName": "_36ed4b61e7a11c9302f851fe25a9b911",
"deviceID": "_2"
},
"modified": {
"timestamp": 1434751588720,
"userRecordName": "_36ed4b61e7a11c9302f851fe25a9b911",
"deviceID": "_2"
}
}
The recordName
is a record's unique identifier, and the Object has a created
attribute which points to an Object with a timestamp
field.
这篇关于如何在CloudKit JS中查询元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!