我有一个带有以下文档的mongoDb数据库:
{
"_id" : NumberLong(932),
...
"validationsPerDay" : {
"20161219" : NumberLong(2),
"20161220" : NumberLong(1),
"20170215" : NumberLong(2),
"20170216" : NumberLong(1),
"20170217" : NumberLong(4),
"20170328" : NumberLong(5)
}
...
}
我需要更新“ validationsPerDay”数组,并增加值。
因此,我正在执行以下查询:
$query = array('_id' => (int) $keyPairId);
$dateKey = KeyPair::getArrayKeyFormatValidationsPerDay($currentDate);
$update = array('$inc' => array("validationsPerDay." . $dateKey => 1));
$options = array('upsert' => true);
$result = $this->collection->updateOne($query, $update, $options);
我收到此错误:
MongoDB\Driver\Exception\BulkWriteException: can't backfill more than 1500000 elements
您能帮我吗?我需要另一种方式吗?该系统位于php 5中,我使用新的mondgb驱动程序将其更新为php 7。