update : 2015.11.03
php.shukuma.com검색:
|
The MongoWriteBatch class(PECL mongo >=1.5.0) 소개MongoWriteBatch is the base class for the MongoInsertBatch, MongoUpdateBatch and MongoDeleteBatch classes. MongoWriteBatch allows you to "batch up" multiple operations (of same type) and shipping them all to MongoDB at the same time. This can be especially useful when operating on many documents at the same time to reduce roundtrips. Prior to version 1.5.0 of the driver it was possible to use MongoCollection::batchInsert(), however, as of 1.5.0 that method is now discouraged. Note: This class is only available when talking to MongoDB 2.6.0 (and later) servers. It will throw MongoProtocolException if attempting to use it on older MongoDB servers. 클래스 개요
MongoWriteBatch
{
/* 상수 */
/* 메소드 */
protected __construct
( MongoCollection
}$collection
[, string $batch_type
[, array $write_options
]] )MongoWriteBatch types
설명When executing a batch, by calling MongoWriteBatch::execute(), MongoWriteBatch will send over » maxWriteBatchSize (defaults to 1000) documents or up to » maxBsonObjectSize (defaults to 16777216 bytes), whichever comes first.
오류/예외
예제Example #1 MongoWriteBatch example Adding documents to a Insert batch and then execute it
<?php 위 예제의 출력: array(2) { ["nInserted"]=> int(3) ["ok"]=> bool(true) } Table of Contents
|