Reputation: 23
I'm trying to use a query with CloudKit JS, and because I'm looking specifically in the public database, I would like to query only the records from a particular user.
Now with the perform query, I know that you can query records based on their record name like so:
var Query = {
recordType: 'Animals',
filterBy: [{systemFieldName: 'recordName', comparator: 'EQUALS', fieldValue: {value:{recordName: "_964c2fe93480jd209485hcgm5"}}}],
sortBy: [{fieldName: 'animal_Name'}]
};
I want to know if it is possible to query the records using the userRecordName found in created and modified objects when records are returned?
I have selected Query under the "createdBy" metadata field for this record type, but have no clue how to query it.
Upvotes: 1
Views: 373
Reputation: 1077
Yes, you can query by the user. Below is a sample, where recordA
is a ID of user recorder.
"query": {
"recordType": "Animals",
"filterBy": [
{
"systemFieldName": "createdUserRecordName",
"comparator": "EQUALS",
"fieldValue": {
"value": {
"recordName": "recordA",
},
"type": "REFERENCE"
}
}
],
Upvotes: 0