<inputtype="search"id="api-filter"placeholder="Type to filter APIs">
</div>
<divid="api-tabview-panel">
<ulid="api-classes"class="apis classes">
<li><ahref="../classes/Represents a
Replicaset Configuration.html">Represents a
Replicaset Configuration</a></li>
<li><ahref="../classes/Represents a BatchWriteResult.html">Represents a BatchWriteResult</a></li>
<li><ahref="../classes/Represents a Collection.html">Represents a Collection</a></li>
<li><ahref="../classes/Represents a Cursor..html">Represents a Cursor.</a></li>
<li><ahref="../classes/Represents a CursorStream..html">Represents a CursorStream.</a></li>
<li><ahref="../classes/Represents a Db.html">Represents a Db</a></li>
<li><ahref="../classes/Represents a GridFS File Stream..html">Represents a GridFS File Stream.</a></li>
<li><ahref="../classes/.html"></a></li>
<li><ahref="../classes/Represents a MongoClient.html">Represents a MongoClient</a></li>
<li><ahref="../classes/Represents a Mongos connection with failover to backup proxies.html">Represents a Mongos connection with failover to backup proxies</a></li>
<li><ahref="../classes/Represents a OrderedBulkOperation.html">Represents a OrderedBulkOperation</a></li>
<li><ahref="../classes/Represents a Read Preference..html">Represents a Read Preference.</a></li>
<li><ahref="../classes/Represents a Server connection..html">Represents a Server connection.</a></li>
<li><ahref="../classes/Represents a UnorderedBulkOperation.html">Represents a UnorderedBulkOperation</a></li>
<li><ahref="../classes/Represents the Admin methods of MongoDB..html">Represents the Admin methods of MongoDB.</a></li>
<li><ahref="../classes/Represents the Grid..html">Represents the Grid.</a></li>
<li><ahref="../classes/Represents the GridStore..html">Represents the GridStore.</a></li>
* Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly)
*
* Options
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
* - **j**, (Boolean, default:false) write waits for journal sync before returning
*
* @class Represents a UnorderedBulkOperation
* @param {Object} collection collection instance.
* @param {Object} [options] additional options for the collection.
* @return {Object} a ordered bulk operation instance.
*/
var UnorderedBulkOperation = function(collection, options) {
options = options == null ? {} : options;
// Contains reference to self
var self = this;
// Get the namesspace for the write operations
var namespace = collection.collectionName;
// Used to mark operation as executed
var executed = false;
// Current item
// var currentBatch = null;
var currentOp = null;
var currentIndex = 0;
var currentBatchSize = 0;
var currentBatchSizeBytes = 0;
var batches = [];
// The current Batches for the different operations
var currentInsertBatch = null;
var currentUpdateBatch = null;
var currentRemoveBatch = null;
// Handle to the bson serializer, used to calculate running sizes
var db = collection.db;
var bson = db.bson;
// Set max byte size
var maxBatchSizeBytes = db.serverConfig.checkoutWriter().maxBsonSize;
var maxWriteBatchSize = db.serverConfig.checkoutWriter().maxWriteBatchSize || 1000;
// Get the write concern
var writeConcern = shared._getWriteConcern(collection, options);
// Final results
var bulkResult = {
ok: 1
, writeErrors: []
, writeConcernErrors: []
, nInserted: 0
, nUpserted: 0
, nMatched: 0
, nModified: 0
, nRemoved: 0
, upserted: []
};
// Specify a full class so we can generate documentation correctly
var FindOperators = function() {
/**
* Add a single update document to the bulk operation
* - **w**, {Number/String, > -1 || 'majority' || tag name} the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = 'majority' or tag acknowledges the write
* - **wtimeout**, {Number, 0} set the timeout for waiting for write concern to finish (combines with w option)
* - **fsync**, (Boolean, default:false) write waits for fsync before returning, from MongoDB 2.6 on, fsync cannot be combined with journal
* - **j**, (Boolean, default:false) write waits for journal sync before returning
*
* @param {Object} [options] additional options during update.
* @param {Function} callback this will be called after executing this method. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain the results from from the unordered bulk operation.