The MongoDB\Driver\WriteError class

- « MongoDB\Driver\WriteConcernError::getMessage

- MongoDB\Driver\WriteError::getCode »

- PHP Manual
- MongoDB\Driver
- The MongoDB\Driver\WriteError class

# The MongoDB\Driver\WriteError class

(mongodb >=1.0.0)

## Introduction

The MongoDB\Driver\WriteError class encapsulates information about a write error and may be returned as an array element from MongoDB\Driver\WriteResult::getWriteErrors().

## Class synopsis

final class MongoDB\Driver\WriteError {
/* Methods */
final public getCode(): int
final public getIndex(): int
final public getInfo(): ?object
final public getMessage(): string
}

## Table of Contents

- MongoDB\Driver\WriteError::getCode — Returns the WriteError's error code
- MongoDB\Driver\WriteError::getIndex — Returns the index of the write operation corresponding to this WriteError
- MongoDB\Driver\WriteError::getInfo — Returns metadata document for the WriteError
- MongoDB\Driver\WriteError::getMessage — Returns the WriteError's error message