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
Methods to manipulate a given collection.
add_index(HASH index)Add an index to a collection
HASH index: definition
String name: index name
add_index_from_property(String property)Add an index to a collection for a property
add_indices(ARRAY index)Add many indices to a collection
ARRAY index: definitions
String name: index name
add_indices_from_property(ARRAY property)Add an index to a collection for a property
ARRAY property: names
Bool ascending: sort documents ascending wrt the property, default true
indiceslist all indices defined for a collection
insert(Core::BigObject one)Insert one or more objects into a given collection
Core::BigObject one: or more objects to be inserted
insert_one_options
insert_array(Array objects)Insert array of objects into a given collection, basic operation, use only for new collections
Array objects: to be inserted
insert_options
remove(String id)Remove one object from a collection identified by its id
String id: the id of the object to remove
remove_allRemove all objects from a collection
set_collection_doc(HASH doc)Set documentation for a collection
HASH doc: the documentation
doc_options
set_info(HASH info)set the info for a new collection
HASH info: the info document
info_options
set_schema(HASH schema)set the schema for a new collection
HASH schema: the schema document
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.
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.
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.
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
ARRAY
find(HASH query)Retrieve all objects satisfying the given search criteria
HASH query: search criteria written in Mongo query language an empty hash map will retrieve all objects in this collection
cursor_options
find_one(HASH query)Retrieve the first object satisfying the given search criteria.
HASH query: search criteria written in Mongo query language an empty hash map will retrieve a random object from this collection
query_options