Class Poco::MongoDB::UpdateRequest
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::MongoDB

# class UpdateRequest

Library: MongoDB
Package: MongoDB
Header: Poco/MongoDB/UpdateRequest.h

## Description

This request is used to update a document in a database using the OP_UPDATE client request.

## Inheritance

Direct Base Classes: RequestMessage

All Base Classes: Message, RequestMessage

## Member Summary

Member Functions: buildRequest, flags, selector, update

Inherited Functions: buildRequest, header, messageLength, send

## Enumerations

### Flags

UPDATE_DEFAULT = 0

If set, the database will insert the supplied object into the collection if no matching document is found.

UPDATE_UPSERT = 1

If set, the database will update all matching objects in the collection. Otherwise only updates first matching doc.

UPDATE_MULTIUPDATE = 2

If set to, updates multiple documents that meet the query criteria. Otherwise only updates one document.

## Constructors

### UpdateRequest

UpdateRequest(
const std::string & collectionName,
Flags flags = UPDATE_DEFAULT
);

Creates the UpdateRequest.

The full collection name is the concatenation of the database name with the collection name, using a "." for the concatenation. For example, for the database "foo" and the collection "bar", the full collection name is "foo.bar".

## Destructor

### ~UpdateRequest

virtual ~UpdateRequest();

Destroys the UpdateRequest.

## Member Functions

### flags

Flags flags() const;

Returns the flags

### flags

void flags(
Flags flags
);

Sets the flags

### selector

Document & selector();

Returns the selector document.

### update

Document & update();

Returns the document to update.

### buildRequest

void buildRequest(
BinaryWriter & writer
);

See also: Poco::MongoDB::RequestMessage::buildRequest()