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

# Poco::MongoDB

# class DeleteRequest

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

## Description

A DeleteRequest is used to delete one ore more documents from a database.

Specific flags for this request

- DELETE_DEFAULT: default delete operation
- DELETE_SINGLE_REMOVE: delete only the first document

## Inheritance

Direct Base Classes: RequestMessage

All Base Classes: Message, RequestMessage

## Member Summary

Member Functions: buildRequest, flags, selector

Inherited Functions: buildRequest, header, messageLength, send

## Enumerations

### Flags

DELETE_DEFAULT = 0

Default

DELETE_SINGLE_REMOVE = 1

Delete only the first document.

## Constructors

### DeleteRequest

DeleteRequest(
const std::string & collectionName,
Flags flags = DELETE_DEFAULT
);

Creates a DeleteRequest for the given collection using the given flags.

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".

### DeleteRequest

DeleteRequest(
const std::string & collectionName,
bool justOne
);

Creates a DeleteRequest for the given collection.

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".

If justOne is true, only the first matching document will be removed (the same as using flag DELETE_SINGLE_REMOVE).

## Destructor

### ~DeleteRequest

virtual ~DeleteRequest();

Destructor

## Member Functions

### flags

Flags flags() const;

Returns the flags.

### flags

void flags(
Flags flag
);

Sets the flags.

### selector

Document & selector();

Returns the selector document.

### buildRequest

void buildRequest(
BinaryWriter & writer
);

Writes the OP_DELETE request to the writer.

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