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

Asked 2 months ago, Updated 2 months ago, 2 views

var Place=monaca.cloud.Collection("place");
varCriteria=Place.find('name=="Monaca", {propertyNames:["title", "body", limit:5});
Place.find(Criteria, "_createdAt DESC", {propertyNames:["title", "body", limit:5})
.done(function(result)
{
   console.log('Total items found:'+result.totalItems);
   console.log('Total items found:'+result.items[0].body);
})
.fail(function(err)
{
   console.log("Err#"+err.code+":"+err.message);
})
});

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


© 2022 OneMinuteCode. All rights reserved.