The number of items registered in the monaca backend collection is displayed, but no details are retrieved.

Asked 5 months ago, Updated 5 months ago, 12 views

varCriteria=Place.find('name=="Monaca", {propertyNames:["title", "body", limit:5});
Place.find(Criteria, "_createdAt DESC", {propertyNames:["title", "body", limit:5})
   console.log('Total items found:'+result.totalItems);
   console.log('Total items found:'+result.items[0].body);

I just wrote the monaca Docs code to fit my environment, but
I was able to get the totalItems, but I wrote
below them. result.items[0].body will be undefind.
There are no errors, so I don't know what's wrong.
Do I have to write any other properties...

javascript monaca

2022-09-30 11:43

1 Answers

I can't do it myself, so I'm going to give you a prediction answer.<> Results is an array, so

console.log('Total items found:'+result.items[0].body);

in the section
console.log('Total items found:'+result[0].items[0].body);

I think you can get it by changing it to .

2022-09-30 11:43

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.