Table of Contents

BigObject PolyDB::Collection

from application common

Represents a collection in PolyDB

Methods

Database Access

Core methods for connecting to the database and retrieving metadata.


get_schema()

Get a JSON validation schema for objects stored in the collection

Returns:

Database Collection Administration

Methods to manipulate a given collection.


add_index(HASH index)

Add an index to a collection

Parameters:

HASH index: definition

Options:

String name: index name


add_index_from_property(String property)

Add an index to a collection for a property

Parameters:

String property

Options:

Bool ascending: sort documents ascending wrt the property, default true


add_indices(ARRAY index)

Add many indices to a collection

Parameters:

ARRAY index: definitions

Options:

String name: index name


add_indices_from_property(ARRAY property)

Add an index to a collection for a property

Parameters:

ARRAY property: names

Options:

Bool ascending: sort documents ascending wrt the property, default true


indices

list all indices defined for a collection


insert(Core::BigObject one)

Insert one or more objects into a given collection

Parameters:

Core::BigObject one: or more objects to be inserted

Options:
option list insert_one_options
Returns:
Int

insert_array(Array objects)

Insert array of objects into a given collection, basic operation, use only for new collections

Parameters:

Array objects: to be inserted

Options:
option list insert_options

remove(String id)

Remove one object from a collection identified by its id

Parameters:

String id: the id of the object to remove


remove_all

Remove all objects from a collection


set_collection_doc(HASH doc)

Set documentation for a collection

Parameters:

HASH doc: the documentation

Options:
option list doc_options

set_info(HASH info)

set the info for a new collection

Parameters:

HASH info: the info document

Options:
option list info_options

set_schema(HASH schema)

set the schema for a new collection

Parameters:

HASH schema: the schema document

Options:
option list schema_options

Database Query Operations

Methods that provide query operations for the database or manipulate the result stream of a query.


count(HASH query)

Return the number of objects satisfying the given search criteria.

Parameters:

HASH query: search criteria written in Mongo query language


count_distinct(HASH query, String property)

Count the distinct property values in objects satisfying the given search criteria.

Parameters:

HASH query: search criteria for objects to be inspected, written in Mongo query language an empty hash map will collect property values from all objects in this collection

String property: name of the property of interest


distinct(HASH query, String property)

Retrieve a list of distinct values of a given property. The values are returned in arbitrary order.

Parameters:

HASH query: search criteria for objects to be inspected, written in Mongo query language an empty hash map will collect property values from all objects in this collection

String property: name of the property of interest

Returns:
ARRAY

find(HASH query)

Retrieve all objects satisfying the given search criteria

Parameters:

HASH query: search criteria written in Mongo query language an empty hash map will retrieve all objects in this collection

Options:
option list cursor_options
Returns:

find_one(HASH query)

Retrieve the first object satisfying the given search criteria.

Parameters:

HASH query: search criteria written in Mongo query language an empty hash map will retrieve a random object from this collection

Options:
option list query_options
Returns: