# Poco::MongoDB

# class QueryRequest

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

## Description

Class for creating an OP_QUERY client request. This request is used to query documents from the database.

## Inheritance

Direct Base Classes: RequestMessage

All Base Classes: Message, RequestMessage

## Member Summary

Member Functions: buildRequest, fullCollectionName, getFlags, getNumberToReturn, getNumberToSkip, returnFieldSelector, selector, setFlags, setNumberToReturn, setNumberToSkip

Inherited Functions: buildRequest, header, messageLength, send

## Types

### QUERY_NONE

typedef enum { QUERY_NONE = 0, QUERY_TAILABLECURSOR = 2, QUERY_SLAVE_OK = 4, QUERY_NOCUROSR_TIMEOUT = 16, QUERY_AWAIT_DATA = 32, QUERY_EXHAUST = 64, QUERY_PARTIAL = 128 } Flags;

## Constructors

### QueryRequest

QueryRequest(
const std::string & collectionName,
Flags flags = QUERY_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".

## Destructor

### ~QueryRequest

virtual ~QueryRequest();

Destructor

## Member Functions

### fullCollectionName

std::string fullCollectionName() const;

Returns the <db>.<collection> used for this query

### getFlags

Flags getFlags() const;

Returns the flags

### getNumberToReturn

Int32 getNumberToReturn() const;

Returns the number to return

### getNumberToSkip

Int32 getNumberToSkip() const;

Returns the number of documents to skip

### returnFieldSelector

Document & returnFieldSelector();

Returns the field selector document

### selector

Document & selector();

Returns the selector document

### setFlags

void setFlags(
Flags flag
);

Set the flags

### setNumberToReturn

void setNumberToReturn(
Int32 n
);

Sets the number to return (limit)

### setNumberToSkip

void setNumberToSkip(
Int32 n
);

Sets the number of documents to skip

### buildRequest

void buildRequest(
BinaryWriter & writer
);

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