I have the following code to retrieve the total number of items in a database that match the "program" field value of either "Coed Spring 2021" or "Coed Spring & Summer 2021"... It is retrieving items that match these parameters but it is only getting 3 items. There are actually 67 items in the database and 45 of them have those matching values.
Here is the code I'm using:
// Mark registration full if over 48 members.
wixData.query("soccerMembersDatabase")
.hasSome("program", ["Coed Spring 2021","Coed Spring & Summer 2021"])
.limit(100)
/*.count()*/
.find()
.then( (results) => {
let coedSpringCount = results.length;
console.log("Coed Spring Members:",coedSpringCount);
console.log(results.items);
if (coedSpringCount >= 48) {
$w("#coedSpringCheckbox").disable();
$w("#coedSpringLine").show();
$w("#coedSpringFullMsg").show();
} else {
$w("#coedSpringCheckbox").enable();
$w("#coedSpringLine").hide();
$w("#coedSpringFullMsg").hide();
}
} )
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} );
I can't see what the issue would be in this case. Would appreciate any ideas/help!
**I have also tried .totalCount instead of .length and both have the same result.