# Poco::MongoDB

# class DeleteRequest

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

## Description

Class for creating an OP_DELETE client request. This request is used to delete one ore more documents from a database.

Specific flags for this request - DELETE_NONE

    No flags

- 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

## Types

### DELETE_NONE

typedef enum { DELETE_NONE = 0, DELETE_SINGLE_REMOVE = 1 } Flags;

## Constructors

### DeleteRequest

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

Constructor. 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
);

Constructor. 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". When 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 flags

### flags

void flags(
Flags flag
);

Sets 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()