Queries return an array results. How I can get a specific field data from the results. In the below example, how I can extract from the "firstItem" or the "results.items" just the first name or last name?
wixData.query("myCollection")
.find() .then( (results) => { let firstItem = results.items[0]; //see item below } )
/* firstItem is:
*
* {
* "_id": "00001", .
* "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
* "_createdDate": "2017-05-24T12:33:18.938Z",
* "_updatedDate": "2017-05-24T12:33:18.938Z",
* "title": "Mr.",
* "first_name": "John",
* "last_name": "Doe" * }
*/
can someone tell me how to get the first_Name from the result item ?
You're welcome.
Thanks!!!!!!!!! It works perfectly.......
Thanks
Do either firstItem.first_name or results.items[0].first_name and either firstItem.last_name or results.items[0].last_name work for you?