BatchWriteResult()

Constructor

Create a new BatchWriteResult instance (INTERNAL TYPE, do not instantiate directly)

class BatchWriteResult()
Arguments:
  • batchResult (object) – internal data structure with results.
Returns:

batchwriteresult a BatchWriteResult instance

Properties

Property
ok {boolean} did bulk operation correctly execute
nInserted {number} number of inserted documents
nUpdated {number} number of documents updated logically
nUpserted {number} number of upserted documents
nModified {number} number of documents updated physically on disk
nRemoved {number} number of removed documents

getUpsertedIds

Return an array of upserted ids

getUpsertedIds()
Returns:array

getUpsertedIdAt

Return the upserted id at position x

getUpsertedIdAt(index)
Arguments:
  • index (number) – the number of the upserted id to return, returns undefined if no result for passed in index
Returns:

array

getRawResponse

Return raw internal result

getRawResponse()
Returns:object

hasWriteErrors

Returns true if the bulk operation contains a write error

hasWriteErrors()
Returns:boolean

getWriteErrorCount

Returns the number of write errors off the bulk operation

getWriteErrorCount()
Returns:number

getWriteErrorAt

Returns a specific write error object

getWriteErrorAt()
Returns:writeerror

getWriteErrors

Retrieve all write errors

getWriteErrors()
Returns:array

getLastOp

Retrieve lastOp if available

getLastOp()
Returns:array

getWriteConcernError

Retrieve the write concern error if any

getWriteConcernError()
Returns:writeconcernerror

Contents

Manual

MongoDB Wiki