SequoiaDB
|
Database operation interfaces of collection. More...
#include <client.hpp>
Public Member Functions | |
sdbCollection () | |
Default constructor. | |
~sdbCollection () | |
Destructor. | |
INT32 | getCount (SINT64 &count, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject) |
Get the count of matching documents in current collection. | |
INT32 | split (const CHAR *pSourceGroupName, const CHAR *pTargetGroupName, const bson::BSONObj &splitCondition, const bson::BSONObj &splitEndCondition=_sdbStaticObject) |
Split the specified collection from source replica group to target replica group by range. | |
INT32 | split (const CHAR *pSourceGroupName, const CHAR *pTargetGroupName, FLOAT64 percent) |
Split the specified collection from source replica group to target replica group by percent. | |
INT32 | splitAsync (SINT64 &taskID, const CHAR *pSourceGroupName, const CHAR *pTargetGroupName, const bson::BSONObj &splitCondition, const bson::BSONObj &splitEndCondition=_sdbStaticObject) |
Split the specified collection from source replica group to target replica group by range. | |
INT32 | splitAsync (const CHAR *pSourceGroupName, const CHAR *pTargetGroupName, FLOAT64 percent, SINT64 &taskID) |
Split the specified collection from source replica group to target replica group by percent. | |
INT32 | alterCollection (const bson::BSONObj &options) |
Alter the current collection. | |
INT32 | insert (const bson::BSONObj &obj, INT32 flags, bson::BSONObj *pResult=NULL) |
Insert a bson object into current collection. | |
INT32 | insert (const bson::BSONObj &obj, const bson::BSONObj &hint, INT32 flags, bson::BSONObj *pResult=NULL) |
Insert a bson object into current collection. | |
INT32 | insert (std::vector< bson::BSONObj > &objs, INT32 flags=0, bson::BSONObj *pResult=NULL) |
Insert a bson object into current collection. | |
INT32 | insert (std::vector< bson::BSONObj > &objs, const bson::BSONObj &hint, INT32 flags=0, bson::BSONObj *pResult=NULL) |
Insert a bson object into current collection. | |
INT32 | insert (const bson::BSONObj objs[], INT32 size, INT32 flags=0, bson::BSONObj *pResult=NULL) |
Insert bson objects into current collection. | |
INT32 | bulkInsert (SINT32 flags, std::vector< bson::BSONObj > &objs) |
Insert a bulk of bson objects into current collection. | |
INT32 | update (const bson::BSONObj &rule, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT32 flag=0, bson::BSONObj *pResult=NULL) |
Update the matching documents in current collection. | |
INT32 | upsert (const bson::BSONObj &rule, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, const bson::BSONObj &setOnInsert=_sdbStaticObject, INT32 flag=0, bson::BSONObj *pResult=NULL) |
Update the matching documents in current collection, insert if no matching. | |
INT32 | del (const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT32 flag=0, bson::BSONObj *pResult=NULL) |
Delete the matching documents in current collection. | |
INT32 | query (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selected=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1, INT32 flags=0) |
Get the matching documents in current collection. | |
INT32 | queryOne (bson::BSONObj &obj, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selected=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT32 flag=0) |
Get the first matching documents in current collection. | |
INT32 | queryAndUpdate (sdbCursor &cursor, const bson::BSONObj &update, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selected=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1, INT32 flag=0, BOOLEAN returnNew=FALSE) |
Get the matching documents in current collection and update. | |
INT32 | queryAndRemove (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selected=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1, INT32 flag=0) |
Get the matching documents in current collection and remove. | |
INT32 | createIndex (const bson::BSONObj &indexDef, const CHAR *pIndexName, BOOLEAN isUnique, BOOLEAN isEnforced, INT32 sortBufferSize=SDB_INDEX_SORT_BUFFER_DEFAULT_SIZE) |
Create the index in current collection. | |
INT32 | createIndex (const bson::BSONObj &indexDef, const CHAR *pIndexName, const bson::BSONObj &options) |
Create the index in current collection. | |
INT32 | getIndexes (sdbCursor &cursor, const CHAR *pIndexName) |
Get all of or one of the indexes in current collection. | |
INT32 | getIndexes (std::vector< bson::BSONObj > &infos) |
Get all of the indexes in current collection. | |
INT32 | getIndex (const CHAR *pIndexName, bson::BSONObj &info) |
Get the specified index in current collection. | |
INT32 | dropIndex (const CHAR *pIndexName) |
Drop the index in current collection. | |
INT32 | create () |
create the specified collection of current collection space | |
INT32 | drop () |
Drop the specified collection of current collection space. | |
const CHAR * | getCollectionName () |
Get the name of specified collection in current collection space. | |
const CHAR * | getCSName () |
Get the name of current collection space. | |
const CHAR * | getFullName () |
Get the full name of specified collection in current collection space. | |
INT32 | aggregate (sdbCursor &cursor, std::vector< bson::BSONObj > &obj) |
Execute aggregate operation in specified collection. | |
INT32 | getQueryMeta (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1) |
Get the index blocks' or data blocks' infomations for concurrent query. | |
INT32 | attachCollection (const CHAR *subClFullName, const bson::BSONObj &options) |
Attach the specified collection. | |
INT32 | detachCollection (const CHAR *subClFullName) |
Dettach the specified collection. | |
INT32 | explain (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &select=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1, INT32 flag=0, const bson::BSONObj &options=_sdbStaticObject) |
Get access plan of query. | |
INT32 | createLob (sdbLob &lob, const bson::OID *oid=NULL) |
Create large object. | |
INT32 | removeLob (const bson::OID &oid) |
Remove large object. | |
INT32 | truncateLob (const bson::OID &oid, INT64 length) |
truncate large object to specified length. | |
INT32 | openLob (sdbLob &lob, const bson::OID &oid, INT32 mode) |
Open an existing large object for reading or writing. | |
INT32 | listLobs (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selected=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1) |
List the lobs' meta data in current collection. | |
INT32 | createLobID (bson::OID &oid, const CHAR *pTimeStamp=NULL) |
INT32 | truncate () |
truncate the collection | |
INT32 | createIdIndex (const bson::BSONObj &options=_sdbStaticObject) |
Create $id index in collection. | |
INT32 | dropIdIndex () |
Drop $id index in collection. | |
INT32 | createAutoIncrement (const bson::BSONObj &options) |
Create an autoincrement field on collection. | |
INT32 | createAutoIncrement (const std::vector< bson::BSONObj > &options) |
Create a bulk of autoincrement fields on collection. | |
INT32 | dropAutoIncrement (const CHAR *fieldName) |
Drop an autoincrement field on collection. | |
INT32 | dropAutoIncrement (const std::vector< const CHAR * > &fieldNames) |
Drop a bulk of autoincrement fields on collection. | |
INT32 | enableSharding (const bson::BSONObj &options=_sdbStaticObject) |
Alter the current collection to enable sharding. | |
INT32 | disableSharding () |
Alter the current collection to disable sharding. | |
INT32 | enableCompression (const bson::BSONObj &options=_sdbStaticObject) |
Alter the current collection to enable compression. | |
INT32 | disableCompression () |
Alter the current collection to disable compression. | |
INT32 | setAttributes (const bson::BSONObj &options) |
Alter the current collection. | |
INT32 | getDetail (sdbCursor &cursor) |
Get the detail of the collection. | |
Public Attributes | |
_sdbCollection * | pCollection |
Database operation interfaces of collection.
|
inline |
Execute aggregate operation in specified collection.
[in] | obj | The array of bson objects |
[out] | cursor | The cursor object of result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the current collection.
[in] | options | The modified options as following: ReplSize : Assign how many replica nodes need to be synchronized when a write request(insert, update, etc) is executed ShardingKey : Assign the sharding key ShardingType : Assign the sharding type Partition : When the ShardingType is "hash", need to assign Partition, it's the bucket number for hash, the range is [2^3,2^20] CompressionType : The compression type of data, could be "snappy" or "lzw" EnsureShardingIndex : Assign to true to build sharding index StrictDataMode : Using strict date mode in numeric operations or not e.g. {RepliSize:0, ShardingKey:{a:1}, ShardingType:"hash", Partition:1024} AutoIncrement: Assign attributes of an autoincrement field or batch autoincrement fields. e.g. {AutoIncrement:{Field:"a",MaxValue:2000}}, {AutoIncrement:[{Field:"a",MaxValue:2000},{Field:"a",MaxValue:4000}]} |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Attach the specified collection.
[in] | subClFullName | The name of the subcollection |
[in] | options | Partition range LowBound: low boudary eg: "LowBound":{a:1} UpBound: up boudary eg: { "UpBound":{a:100} } |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Insert a bulk of bson objects into current collection.
[in] | flags | The flag to control the behavior of inserting. The value of flag default to be 0, and it can choose the follow values:
|
[in] | objs | The bson objects to be inserted. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
create the specified collection of current collection space
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create an autoincrement field on collection.
[in] | options | The options as following: Field : The name of autoincrement field StartValue : The start value of autoincrement field MinValue : The minimum value of autoincrement field MaxValue : The maxmun value of autoincrement field Increment : The increment value of autoincrement field CacheSize : The cache size of autoincrement field AcquireSize : The acquire size of autoincrement field Cycled : The cycled flag of autoincrement field Generated : The generated mode of autoincrement field |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create a bulk of autoincrement fields on collection.
[in] | options | The option array of autoincrement fields |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create $id index in collection.
[in] | options | The arguments of creating id index.e.g.{SortBufferSize:64} SortBufferSize : The size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create the index in current collection.
[in] | indexDef | The bson structure of index element, e.g. {name:1, age:-1} |
[in] | pIndexName | The index name |
[in] | isUnique | Whether the index elements are unique or not |
[in] | isEnforced | Whether the index is enforced unique This element is meaningful when isUnique is set to true |
[in] | sortBufferSize | The size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create the index in current collection.
[in] | indexDef | The bson structure of index element, e.g. {name:1, age:-1} |
[in] | pIndexName | The index name |
[in] | options | The options are as below: Unique: Whether the index elements are unique or not Enforced: Whether the index is enforced unique. This element is meaningful when Unique is true NotNull: Any field of index key should exist and cannot be null when NotNull is true SortBufferSize: The size of sort buffer used when creating index. Unit is MB. Zero means don't use sort buffer NotArray: Any field of index not support array when NotArray is true |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create large object.
[in] | oid | The id of the large object |
[out] | lob | The newly create large object |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
[in] | pTimestamp | point of Timestamp(format:YYYY-MM-DD-HH.mm.ss). if Timestamp is NULL the Timestamp will be generated by server |
[out] | oid | The oid generated by server |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Delete the matching documents in current collection.
[in] | condition | The matching rule, delete all the documents if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | flag | The delete flag, default to be 0 |
[out] | pResult | The detail result for deleting |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Dettach the specified collection.
[in] | subClFullName | The name of the subcollection |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the current collection to disable compression.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the current collection to disable sharding.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop the specified collection of current collection space.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop an autoincrement field on collection.
[in] | fieldName | The name of autoincrement field |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop a bulk of autoincrement fields on collection.
[in] | fieldNames | The array of autoincrement field names |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop $id index in collection.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop the index in current collection.
[in] | pIndexName | The index name |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the current collection to enable compression.
[in] | options | The modified options as following: CompressionType : The compression type of data, could be "snappy" or "lzw" |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the current collection to enable sharding.
[in] | options | The modified options as following: ShardingKey : Assign the sharding key ShardingType : Assign the sharding type Partition : When the ShardingType is "hash", need to assign Partition, it's the bucket number for hash, the range is [2^3,2^20] EnsureShardingIndex : Assign to true to build sharding index |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get access plan of query.
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[in] | flag | The query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag |
[in] | options | the rules of explain, the options are as below: Run : Whether execute query explain or not, true for excuting query explain then get the data and time information; false for not excuting query explain but get the query explain information only. e.g. {Run:true} |
[out] | cursor | The cursor of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the name of specified collection in current collection space.
|
inline |
Get the count of matching documents in current collection.
[in] | condition | The matching rule, return the count of all documents if this parameter is empty |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[out] | count | The count of matching documents, matches all records if not provided. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the name of current collection space.
|
inline |
Get the detail of the collection.
[out] | cursor | Return the all the info of current collection. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the full name of specified collection in current collection space.
|
inline |
Get the specified index in current collection.
[in] | pIndexName | The index name, returns all of the indexes if this parameter is null |
[out] | info | The information of the index. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get all of or one of the indexes in current collection.
[in] | pIndexName | The index name, returns all of the indexes if this parameter is null |
[out] | cursor | The cursor of all the result for current query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get all of the indexes in current collection.
[out] | infos | Vector for the information of all the index. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the index blocks' or data blocks' infomations for concurrent query.
[in] | condition | The matching rule, return the whole range of index blocks if not provided eg:{"age":{"$gt":25},"age":{"$lt":75}} |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | numToReturn | Only return numToReturn documents, default is -1 for returning all results |
[out] | cursor | The result of query |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Insert a bson object into current collection.
[in] | obj | The bson object to be inserted. |
[in] | flags | The flag to control the behavior of inserting. The value of flag default to be 0, and it can choose the follow values:
|
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Insert a bson object into current collection.
[in] | obj | The bson object to be inserted. |
[in] | hint. | Client and Query information. Default to be empty when not provided. |
[in] | flags | The flag to control the behavior of inserting. The value of flag default to be 0, and it can choose the follow values:
|
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Insert a bson object into current collection.
[in] | objs | The bson objects to be inserted. |
[in] | flags | The flag to control the behavior of inserting. The value of flag default to be 0, and it can choose the follow values:
|
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Insert a bson object into current collection.
[in] | objs | The bson objects to be inserted. |
[in] | hint. | Client and Query information. Default to be empty when not provided. |
[in] | flags | The flag to control the behavior of inserting. The value of flag default to be 0, and it can choose the follow values:
|
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Insert bson objects into current collection.
[in] | objs | The array of bson objects to be inserted. |
[in] | size | The size of the array. |
[in] | flags | The flag to control the behavior of inserting. The value of flag default to be 0, and it can choose the follow values:
|
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
List the lobs' meta data in current collection.
[in] | condition | The matching rule, return all the lob if not provided |
[in] | selected | The selective rule, return the whole infomation if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs; |
[in] | numToSkip | Skip the first numToSkip lob, default is 0 |
[in] | numToReturn | Only return numToReturn lob, default is -1 for returning all results |
[out] | cursor | The curosr reference of the result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Open an existing large object for reading or writing.
[in] | oid | The id of the large object |
[out] | lob | The large object to get |
[in] | lob | open mode, should be SDB_LOB_READ or SDB_LOB_WRITE or SDB_LOB_SHAREREAD or SDB_LOB_WRITE | SDB_LOB_SHAREREAD |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the matching documents in current collection.
[in] | condition | The matching rule, return all the documents if not provided |
[in] | selected | The selective rule, return the whole document if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | numToReturn | Only return numToReturn documents, default is -1 for returning all results |
[in] | flag | The query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag |
[out] | cursor | The cursor of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the matching documents in current collection and remove.
[in] | condition | The matching rule, return all the documents if not provided |
[in] | selected | The selective rule, return the whole document if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | numToReturn | Only return numToReturn documents, default is -1 for returning all results |
[in] | flag | The query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag |
[out] | cursor | The cursor of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the matching documents in current collection and update.
[in] | update | The update rule, can't be empty |
[in] | condition | The matching rule, return all the documents if not provided |
[in] | selected | The selective rule, return the whole document if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | numToReturn | Only return numToReturn documents, default is -1 for returning all results |
[in] | flag | The query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag |
[in] | returnNew | When TRUE, returns the updated document rather than the original |
[out] | cursor | The cursor of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the first matching documents in current collection.
[in] | condition | The matching rule, return all the documents if not provided |
[in] | selected | The selective rule, return the whole document if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | flag | The query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag |
[out] | obj | The first matching object |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Remove large object.
[in] | oid | The id of the large object |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the current collection.
[in] | options | The modified options as following: ReplSize : Assign how many replica nodes need to be synchronized when a write request(insert, update, etc) is executed ShardingKey : Assign the sharding key ShardingType : Assign the sharding type Partition : When the ShardingType is "hash", need to assign Partition, it's the bucket number for hash, the range is [2^3,2^20] CompressionType : The compression type of data, could be "snappy" or "lzw" EnsureShardingIndex : Assign to true to build sharding index StrictDataMode : Using strict date mode in numeric operations or not e.g. {RepliSize:0, ShardingKey:{a:1}, ShardingType:"hash", Partition:1024} AutoIncrement: Assign attributes of an autoincrement field or batch autoincrement fields. e.g. {AutoIncrement:{Field:"a",MaxValue:2000}}, {AutoIncrement:[{Field:"a",MaxValue:2000},{Field:"a",MaxValue:4000}]} |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Split the specified collection from source replica group to target replica group by range.
[in] | pSourceGroupName | The source replica group name |
[in] | pTargetGroupName | The target replica group name |
[in] | splitCondition | The split condition |
[in] | splitEndCondition | The split end condition or null eg:If we create a collection with the option {ShardingKey:{"age":1},ShardingType:"Hash",Partition:2^10}, we can fill {age:30} as the splitCondition, and fill {age:60} as the splitEndCondition. when split, the target replica group will get the records whose age's hash value are in [30,60). If splitEndCondition is null, they are in [30,max). |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Split the specified collection from source replica group to target replica group by percent.
[in] | pSourceGroupName | The source replica group name |
[in] | pTargetGroupName | The target replica group name |
[in] | percent | The split percent, Range:(0,100] |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Split the specified collection from source replica group to target replica group by range.
[out] | taskID | The id of current split task |
[in] | pSourceGroupName | The source replica group name |
[in] | pTargetGroupName | The target replica group name |
[in] | splitCondition | The split condition |
[in] | splitEndCondition | The split end condition or null eg:If we create a collection with the option {ShardingKey:{"age":1},ShardingType:"Hash",Partition:2^10}, we can fill {age:30} as the splitCondition, and fill {age:60} as the splitEndCondition. when split, the target replica group will get the records whose age's hash value are in [30,60). If splitEndCondition is null, they are in [30,max). |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Split the specified collection from source replica group to target replica group by percent.
[in] | pSourceGroupName | The source replica group name |
[in] | pTargetGroupName | The target replica group name |
[in] | percent | The split percent, Range:(0.0, 100.0] |
[out] | taskID | The id of current split task |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
truncate the collection
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
truncate large object to specified length.
[in] | oid | The id of the large object |
[in] | length | The truncate length |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Update the matching documents in current collection.
[in] | rule | The updating rule |
[in] | condition | The matching rule, update all the documents if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | flag | The update flag, default to be 0. Please see the definition of follow flags for more detail |
[out] | pResult | The detail result for updating. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Update the matching documents in current collection, insert if no matching.
[in] | rule | The updating rule |
[in] | condition | The matching rule, update all the documents if not provided |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[in] | setOnInsert | The setOnInsert assigns the specified values to the fileds when insert |
[in] | flag | The upsert flag, default to be 0. Please see the definition of follow flags for more detail |
[out] | pResult | The detail result for upserting |
SDB_OK | Operation Success |
Others | Operation Fail |
sdbclient::sdbCollection::pCollection |
A pointer of virtual base class _sdbCollection
Class sdbCollection is a shell for _sdbCollection. We use pCollection to call the methods in class _sdbCollection.