Answer the question
In order to leave comments, you need to log in
What's wrong with deleteAll?
Tried to organize bulk deletion like this
public function removeList($collection_id, $ids){
$list=[];
foreach ($ids as $ind) {
$v = static::NormalizeNumber($ind);
if ($v) {
$list[] = $v;
}
}
try {
self::deleteAll(['and',['id'=> $list,'collection_id'=>$collection_id]]);
}catch (\Exception $e) {
return $e->getMessage();
}
return 'ok';
}
viber.phone.bulkWrite([{"type":"delete","condition":{"$and":[{"_id":{"$in":["572457469782","572457469783"]}," collection_id":"1"}]},"options":{"limit":0}}])
Answer the question
In order to leave comments, you need to log in
self::deleteAll(['and',['id'=> $list,'collection_id'=>$collection_id]]);
and
is redundant. You can simply:self::find()->where(['id' => $list, 'collection_id' => $collection_id])->count();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question