# Poco::MongoDB

# class Array

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

## Description

Implements the BSON Array

## Inheritance

Direct Base Classes: Document

All Base Classes: Document

## Member Summary

Member Functions: get, isType, toString

Inherited Functions: add, addElement, addNewDocument, clear, elementNames, empty, exists, get, isType, read, size, toString, write

## Types

### Ptr

typedef SharedPtr < Array > Ptr;

## Constructors

### Array

Array();

Constructor

## Destructor

### ~Array

virtual ~Array();

Destructor

## Member Functions

### get

template < typename T > T get(
int pos
) const;

Returns the element on the given index and tries to convert it to the template type. When the element is not found, a NotFoundException will be thrown. When the element can't be converted a BadCastException will be thrown.

### get

template < typename T > T get(
int pos,
const T & def
) const;

Returns the element on the given index and tries to convert it to the template type. When the element is not found, or has the wrong type, the def argument will be returned.

### get

Element::Ptr get(
int pos
) const;

Returns the element on the given index. An empty element will be returned when the element is not found.

### isType

template < typename T > bool isType(
int pos
);

Returns true when the type of the element equals the TypeId of ElementTrait

### toString

std::string toString(
int indent = 0
) const;

See also: Poco::MongoDB::Document::toString()