Poco::MongoDB

class Array

File Information

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

Description

This class represents a 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, getInteger, isType, read, size, toString, write

Types Aliases

Ptr

using Ptr = SharedPtr < Array >;

Constructors

Array

Array();

Creates an empty Array.

Destructor

~Array virtual

virtual ~Array();

Destroys the Array.

Member Functions

get inline

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

Returns the element at the given index and tries to convert it to the template type. If the element is not found, a Poco::NotFoundException will be thrown. If the element cannot be converted a BadCastException will be thrown.

get inline

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

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

get

Element::Ptr get(
    int pos
) const;

Returns the element at the given index. An empty element will be returned if the element is not found.

isType inline

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

Returns true if the type of the element equals the TypeId of ElementTrait, otherwise false.

toString virtual

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

Returns a string representation of the Array.

Securely control IoT edge devices from anywhere   Connect a Device