How to query for Metadata in CloudKit JS?

巧了我就是萌 提交于 2019-12-10 11:51:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/31037042/how-to-query-for-metadata-in-cloudkit-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!