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(String name, HASH index)
Add an index to a collection
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, must include the name of the index
add_indices_from_properties(ARRAY property)
Add an index to a collection for a property
get_index_names
Get a list of the names of indices defined for the collection
get_indexes
Get a list of indices defined for the collection
indices
list all indices defined for a collection
insert_many(Core::BigObject array)
Insert one object into the collection
Core::BigObject
array
: of objects to be inserted
insert_options
insert_one(Core::BigObject object)
Insert one object into the collection
Core::BigObject
object
: to be inserted
insert_one_options
remove_all
Remove all objects from a collection matching the given filter, default is all
remove_one(String id)
Remove one object from a collection identified by its id
String
id
: the id of the object to remove
replace_one(Core::BigObject object)
Replaces one object in the collection based on the id
Core::BigObject
object
: to be inserted
insert_one_options
set_doc(HASH doc)
Set documentation for a collection
HASH
doc
: the documentation
Bool
update
: default false
set_info(HASH info, String id)
Set the info doc
HASH
info
: the info document
String
id
: the id of the info
set_schema(HASH schema, String id)
Set the info doc
HASH
schema
: the schema document
String
id
: the id of the schema
Methods that provide query operations for the database or manipulate the result stream of a query.
aggregate(HASH pipeline)
Run a mongodb aggregation pipeline in a collection
HASH
pipeline
: , written in Mongo query language
cursor_options
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
sample_one(HASH query)
Return a random element matching the query
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
cursor_options
name
UNDOCUMENTED
update_one
UNDOCUMENTED