當我嘗試使用laravel爲我的文檔建立索引時出現錯誤。MongoDB Driver Exception InvalidArgumentException在您的平臺上檢測到整數溢出:300000000000
這是我的主要代碼。通過使用die語句,我知道在執行第一行時出現「[MongoDB \ Driver \ Exception \ InvalidArgumentException]平臺上檢測到的整數溢出錯誤:300000000000」: $ users = User ::所有();
$users = User::all();
foreach ($users as $user) {
$temp=$user['attributes'];
unset($temp['_id']);
$params = [
'index' => 'test_index',
'type' => $temp['vehicle_type'],
'id' => $temp['lid'],
'body' => $temp
];
print_r($params); die;
$response = $client->index($params);
set_time_limit(100);
}
}``
我使用https://github.com/jenssegers/laravel-mongodb接口Laravel和MongoDB。 我的用戶模型看起來像這樣
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
class User extends Eloquent
{
protected $connection = 'mongodb';
protected $collection = 'Test4';
}
Test4包含大數據。但是,我確定我的映射中沒有可能導致整數溢出錯誤的任何整數。請幫助我。我是Laravel和MongoDB的新手 我很樂意提供可能需要的更多信息。我得到這個錯誤「PHP致命錯誤:134217728字節允許內存大小用盡(試圖分配40字節)在C:\ xampp \ htdocs \ ProTest1 \ vendor \ jenssegers \ mongodb \ src \ Jenssegers \ Mongodb \ Query \ Builder.php on line 392「
「大」是如何收集? 'User :: all()'意味着你要求「全部」內容。對於超出「小」尺寸的任何東西,這可能不是一個明智的做法。實際上['all()'](https://laravel.com/docs/5.4/collections#method-all)似乎暗示着這會將「光標」變成一個「數組」,而那真的不會明智點吧。 –
看來你試圖將bigdata類型存儲爲整數,所以你得到這個異常 –
Neil Lunn,謝謝你的回覆。實際上,數據中包含約75k個文件,約佔7GB空間。 –