====== BigObject PolyDB::Collection ====== //from application [[..:common|common]]//\\ \\ Represents a collection in PolyDB ===== Methods ===== ==== Database Access ==== Core methods for connecting to the database and retrieving metadata. ---- {{anchor:get_schema:}} ? **''get_schema()''** :: Get a JSON validation schema for objects stored in the collection ? Returns: :''[[..:core:Schema |Schema]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- ==== Database Collection Administration ==== Methods to manipulate a given collection. ---- {{anchor:add_index:}} ? **''add_index([[..:common#String |String]] name, HASH index)''** :: Add an index to a collection ? Parameters: :: ''[[..:common#String |String]]'' ''name'': of the index :: ''HASH'' ''index'': definition ? Options: : :: ''[[..:common#String |String]]'' ''name'': index name ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:add_index_from_property:}} ? **''add_index_from_property([[..:common#String |String]] property)''** :: Add an index to a collection for a property ? Parameters: :: ''[[..:common#String |String]]'' ''property'' ? Options: : :: ''[[..:common#Bool |Bool]]'' ''ascending'': sort documents ascending wrt the property, default true :: ''[[..:common#Bool |Bool]]'' ''unique'': set true if the property is unique, default false ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:add_indices:}} ? **''add_indices(ARRAY index)''** :: Add many indices to a collection ? Parameters: :: ''ARRAY'' ''index'': definitions, must include the name of the index ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:add_indices_from_properties:}} ? **''add_indices_from_properties(ARRAY property)''** :: Add an index to a collection for a property ? Parameters: :: ''ARRAY'' ''property'': names ? Options: : :: ''[[..:common#Bool |Bool]]'' ''ascending'': sort documents ascending wrt the property, default true :: ''[[..:common#Bool |Bool]]'' ''unique'': set true if the property is unique, default false ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:get_index_names:}} ? **''get_index_names''** :: Get a list of the names of indices defined for the collection ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:get_indexes:}} ? **''get_indexes''** :: Get a list of indices defined for the collection ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:indices:}} ? **''indices''** :: FIXME list all indices defined for a collection ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:insert_many:}} ? **''insert_many([[..:core:Core_BigObject |Core::BigObject]] array)''** :: Insert one object into the collection ? Parameters: :: ''[[..:core:Core_BigObject |Core::BigObject]]'' ''array'': of objects to be inserted ? Options: : option list ''[[..:common#insert_options |insert_options]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:insert_one:}} ? **''insert_one([[..:core:Core_BigObject |Core::BigObject]] object)''** :: Insert one object into the collection ? Parameters: :: ''[[..:core:Core_BigObject |Core::BigObject]]'' ''object'': to be inserted ? Options: : option list ''[[..:common#insert_one_options |insert_one_options]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:remove_all:}} ? **''remove_all''** :: Remove all objects from a collection matching the given filter, default is all ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:remove_one:}} ? **''remove_one([[..:common#String |String]] id)''** :: Remove one object from a collection identified by its id ? Parameters: :: ''[[..:common#String |String]]'' ''id'': the id of the object to remove ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:replace_one:}} ? **''replace_one([[..:core:Core_BigObject |Core::BigObject]] object)''** :: Replaces one object in the collection based on the id ? Parameters: :: ''[[..:core:Core_BigObject |Core::BigObject]]'' ''object'': to be inserted ? Options: : option list ''[[..:common#insert_one_options |insert_one_options]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:set_doc:}} ? **''set_doc(HASH doc)''** :: Set documentation for a collection ? Parameters: :: ''HASH'' ''doc'': the documentation ? Options: : :: ''[[..:common#Bool |Bool]]'' ''update'': default false ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:set_info:}} ? **''set_info(HASH info, [[..:common#String |String]] id)''** :: Set the info doc ? Parameters: :: ''HASH'' ''info'': the info document :: ''[[..:common#String |String]]'' ''id'': the id of the info ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:set_schema:}} ? **''set_schema(HASH schema, [[..:common#String |String]] id)''** :: Set the info doc ? Parameters: :: ''HASH'' ''schema'': the schema document :: ''[[..:common#String |String]]'' ''id'': the id of the schema ? from extension: : [[:external_software|bundled:polydb]] ---- ==== Database Query Operations ==== Methods that provide query operations for the database or manipulate the result stream of a query. ---- {{anchor:aggregate:}} ? **''aggregate(HASH pipeline)''** :: Run a mongodb aggregation pipeline in a collection ? Parameters: :: ''HASH'' ''pipeline'': , written in Mongo query language ? Options: : option list ''[[..:common#cursor_options |cursor_options]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:count:}} ? **''count(HASH query)''** :: Return the number of objects satisfying the given search criteria. ? Parameters: :: ''HASH'' ''query'': search criteria written in Mongo query language ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:count_distinct:}} ? **''count_distinct(HASH query, [[..:common#String |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 :: ''[[..:common#String |String]]'' ''property'': name of the property of interest ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:distinct:}} ? **''distinct(HASH query, [[..:common#String |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 :: ''[[..:common#String |String]]'' ''property'': name of the property of interest ? Returns: :''ARRAY'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:find:}} ? **''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 ''[[..:common#cursor_options |cursor_options]]'' ? Returns: :''[[..:common:PolyDB_Cursor |PolyDB::Cursor]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:find_one:}} ? **''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 ''[[..:common#query_options |query_options]]'' ? Returns: :''[[..:core:Core_BigObject |Core::BigObject]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:sample_one:}} ? **''sample_one(HASH query)''** :: Return a random element matching the query ? 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 ? Options: : option list ''[[..:common#cursor_options |cursor_options]]'' ? from extension: : [[:external_software|bundled:polydb]] ---- ==== no category ==== {{anchor:name:}} ? **''name''** ::UNDOCUMENTED ? from extension: : [[:external_software|bundled:polydb]] ---- {{anchor:update_one:}} ? **''update_one''** ::UNDOCUMENTED ? from extension: : [[:external_software|bundled:polydb]] ----