documentation:release:4.2:common:polydb_collection

Available versions of this document: latest release, release 4.13, release 4.12, release 4.11, release 4.10, release 4.9, release 4.8, release 4.7, release 4.6, release 4.5, release 4.4, release 4.3, release 4.2, release 4.1, release 4.0, release 3.6, release 3.5, nightly master

Reference documentation for older polymake versions: release 3.4, release 3.3, release 3.2

BigObject PolyDB::Collection

from application common

Represents a collection in PolyDB

Core methods for connecting to the database and retrieving metadata.


get_schema()

Get a JSON validation schema for objects stored in the collection

Returns:

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 to be inserted into the database, or a filename containing an object or an array of objects

Options:
option list insert_options
Returns:
Int

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

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:

  • documentation/release/4.2/common/polydb_collection.txt
  • Last modified: 2020/09/10 17:50
  • by 127.0.0.1