我有以下代码:
// company_ids is an array of mongo IDs
// company_id is an array (with only 1 element) of mongo ID
foreach($company_ids as $company_id){
$results = Archive::where("billing.company._id", 'all', array($company_id))->get();
...
这是输出Log::info(print_r($company_ids, true))
[2016-10-22 02:41:27] production.INFO: Array
(
[0] => 57515764b91a8c4d008b45d1
[1] => 57515764b91a8c4d008b45d6
[2] => 57515764b91a8c4d008b45db
[3] => 57515764b91a8c4d008b45e0
...
)
如何Archive
使用循环直接查询集合company_ids
并消除对foreach
循环的需求?