Can I use a string partial match wildcard in MonaQL?

Asked 1 months ago, Updated 1 months ago, 1 views

Thank you for your help.

Here's the code.

"I would like to extract records containing ""2014/8"" (corresponding to August 2014) using wildcards in line 3 overDate, how should I describe them?"

var UserDetails=monaca.cloud.Collection('UserDetails');
varcriteriaStr='push_flg=="1";
criteriaStr+='&overDate=='+from_yyy+'/'+from_m+'/*';
varCriteria=monaca.cloud.Criteria(criteriaStr);
UserDetails.find(Criteria, 'User_Oid ASC', {propertyNames: ["User_Oid"] } )
  .done(function(result){
     // processing
    .fail(function(error){
      // Push notification will not be provided if the target user ID retrieval fails.
      alert('Failed to retrieve target user.' );
      return;
    }
  });

monaca

2022-09-30 11:13

1 Answers

There seems to be no wildcard, so how about making it like the method below?

varmonaQuery=buildMonaQuery(2014,8);

varCriteria=monaca.cloud.Criteria(
  'overDate IN?',
  [monaQuery]
); 

function buildMonaQuery(from_year, from_month){
    var result=[];
    for(vari=1;i<=31;i++){
        result.push(from_year+'/'+from_month+'/'+i);
    }
    return result;
}


2022-09-30 11:13

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.