SequoiaDB
 All Classes Namespaces Files Functions Variables Enumerations Properties Pages
Public Member Functions | Properties | List of all members
SequoiaDB.DBCollection Class Reference

Database operation interfaces of collection. More...

Public Member Functions

void Split (string sourceGroupName, string destGroupName, BsonDocument splitCondition, BsonDocument splitEndCondition)
 Split the collection from one group into another group by range.
 
void Split (string sourceGroupName, string destGroupName, double percent)
 Split the collection from one group into another group by percent.
 
long SplitAsync (String sourceGroupName, String destGroupName, BsonDocument splitCondition, BsonDocument splitEndCondition)
 Split the specified collection from source group to target group by range asynchronously.
 
long SplitAsync (String sourceGroupName, String destGroupName, double percent)
 Split the specified collection from source group to target group by percent asynchronously.
 
void BulkInsert (List< BsonDocument > records, int flags)
 Insert a bulk of bson objects into current collection.
 
BsonDocument Insert (List< BsonDocument > recordList, int flags)
 Insert documents into current collection.
 
BsonDocument Insert (BsonDocument record, int flags)
 Insert a document into current collection.
 
BsonValue Insert (BsonDocument record)
 Insert a document into current collection.
 
void Delete (BsonDocument matcher)
 Delete the matching document of current collection.
 
void Delete (BsonDocument matcher, BsonDocument hint)
 Delete the matching document of current collection.
 
void Update (DBQuery query)
 Update the document of current collection.
 
void Update (BsonDocument matcher, BsonDocument modifier, BsonDocument hint)
 Update the document of current collection.
 
void Update (BsonDocument matcher, BsonDocument modifier, BsonDocument hint, int flag)
 Update the document of current collection.
 
void Upsert (BsonDocument matcher, BsonDocument modifier, BsonDocument hint)
 Update the document of current collection, insert if no matching.
 
void Upsert (BsonDocument matcher, BsonDocument modifier, BsonDocument hint, BsonDocument setOnInsert)
 Update the document of current collection, insert if no matching.
 
void Upsert (BsonDocument matcher, BsonDocument modifier, BsonDocument hint, BsonDocument setOnInsert, int flag)
 Update the document of current collection, insert if no matching.
 
DBCursor Query ()
 Find all documents of current collection.
 
DBCursor Query (DBQuery query)
 Find documents of current collection with DBQuery.
 
DBCursor Query (BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint)
 Find documents of current collection.
 
DBCursor Query (BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, long skipRows, long returnRows)
 Find documents of current collection.
 
DBCursor Query (BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, long skipRows, long returnRows, int flag)
 Find documents of current collection.
 
DBCursor QueryAndUpdate (BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, BsonDocument update, long skipRows, long returnRows, int flag, bool returnNew)
 Find documents of current collection and update.
 
DBCursor QueryAndRemove (BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, long skipRows, long returnRows, int flag)
 Find documents of current collection and remove.
 
DBCursor Explain (BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, long skipRows, long returnRows, int flag, BsonDocument options)
 Find documents of current collection.
 
DBCursor GetIndexes ()
 Get all the indexes of current collection.
 
DBCursor GetIndex (string name)
 Get the named index of current collection.
 
BsonDocument GetIndexInfo (string name)
 Get the information of index in current collection.
 
BsonDocument GetIndexStat (string name)
 Get the statistics of the index.
 
bool IsIndexExist (string name)
 Test the specified index exist or not.
 
void CreateIndex (string name, BsonDocument key, bool isUnique, bool isEnforced)
 Create an index with name and key.
 
void CreateIndex (string name, BsonDocument key, bool isUnique, bool isEnforced, int sortBufferSize)
 Specify sort buffer size to create an index.
 
void CreateIndex (string name, BsonDocument key, BsonDocument options)
 Create an index with options.
 
void DropIndex (string name)
 Remove the named index of current collection.
 
long GetCount (BsonDocument matcher, BsonDocument hint)
 Get the count of matching documents in current collection.
 
long GetCount (BsonDocument matcher)
 Get the count of matching documents in current collection.
 
DBCursor Aggregate (List< BsonDocument > obj)
 Execute aggregate operation in specified collection.
 
DBCursor GetQueryMeta (BsonDocument query, BsonDocument orderBy, BsonDocument hint, long skipRows, long returnRows)
 Get the index blocks' or data blocks' infomations for concurrent query.
 
void AttachCollection (string subClFullName, BsonDocument options)
 Attach the specified collection.
 
void DetachCollection (string subClFullName)
 Detach the specified collection.
 
void Alter (BsonDocument options)
 Alter the attributes of current collection.
 
DBCursor ListLobs ()
 List all of the lobs in current collection.
 
DBCursor ListLobs (BsonDocument matcher, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, long skipRows, long returnRows)
 List the lobs.
 
ObjectId CreateLobID (DateTime dt)
 Create a lobID from server by using the user-provided DateTime.
 
ObjectId CreateLobID ()
 Create a lobID from server by using the server's system time.
 
DBLob CreateLob ()
 Create a large object.
 
DBLob CreateLob (ObjectId id)
 Create a large object with specified oid.
 
DBLob OpenLob (ObjectId id, int mode)
 Open an existing lob with the speceifed oid.
 
DBLob OpenLob (ObjectId id)
 Open an existing lob with the speceifed oid.
 
void RemoveLob (ObjectId id)
 Remove an existing lob with the speceifed oid.
 
void TruncateLob (ObjectId id, long length)
 Truncate an exist lob.
 
void Truncate ()
 Truncate the collection.
 
void CreateIdIndex (BsonDocument options)
 Create $id index in collection.
 
void DropIdIndex ()
 Drop $id index in collection.
 
void EnableSharding (BsonDocument options)
 Alter the attributes of current collection to enable sharding.
 
void DisableSharding ()
 Alter the attributes of current collection to disable sharding

Exceptions
SequoiaDB.BaseException
System.Exception.

 
void EnableCompression (BsonDocument options)
 Alter the attributes of current collection to enable compression.
 
void DisableCompression ()
 Alter the attributes of current collection to enable compression

Exceptions
SequoiaDB.BaseException
System.Exception.

 
void SetAttributes (BsonDocument options)
 Alter the attributes of current collection to set attributes.
 
void CreateAutoIncrement (BsonDocument options)
 Create autoincrement field on collection.
 
void CreateAutoIncrement (List< BsonDocument > optionsList)
 Create autoincrement field on collection.
 
void DropAutoIncrement (String fieldName)
 Drop autoincrement field on collection.
 
void DropAutoIncrement (List< string > fieldNames)
 Drop autoincrement fields on collection.
 

Properties

bool EnsureOID [get, set]
 Get or set whether insert oid in records when bulk insert.
 
string Name [get]
 Return the name of current collection.
 
string FullName [get]
 Return the full name of current collection.
 
CollectionSpace CollSpace [get]
 

Detailed Description

Database operation interfaces of collection.

Member Function Documentation

DBCursor SequoiaDB.DBCollection.Aggregate ( List< BsonDocument obj)
inline

Execute aggregate operation in specified collection.

Parameters
insertorThe array of bson objects, can't be null
Returns
The DBCursor of result or null
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.Alter ( BsonDocument  options)
inline

Alter the attributes of current collection.

Parameters
optionsThe options for altering current collection:
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}]}
Note
Can't alter attributes about split in partition collection; After altering a collection to be a partition collection, need to split this collection manually
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.AttachCollection ( string  subClFullName,
BsonDocument  options 
)
inline

Attach the specified collection.

Parameters
subClFullNameThe name of the subcollection
optionsThe low boudary and up boudary eg: {"LowBound":{a:1},"UpBound":{a:100}}
Return values
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.BulkInsert ( List< BsonDocument records,
int  flags 
)
inline

Insert a bulk of bson objects into current collection.

Parameters
recordsThe Bson document of insertor list, can't be null
flagsThe flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
  • 0 : while 0 is set(default to be 0), database will stop inserting when the record hit index key duplicate error.
  • SDBConst.FLG_INSERT_CONTONDUP : if the record hit index key duplicate error, database will skip them and go on inserting.
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.CreateAutoIncrement ( BsonDocument  options)
inline

Create autoincrement field on collection.

Parameters
optionsOptions for creating autoincrement, can not be null or empty. e.g.{ Field: "a", MaxValue:2000 }
 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.
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.CreateAutoIncrement ( List< BsonDocument optionsList)
inline

Create autoincrement field on collection.

Parameters
optionsListOptions for creating autoincrement, can not be null or empty.
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.CreateIdIndex ( BsonDocument  options)
inline

Create $id index in collection.

Parameters
optionsOptions for create id index, or null for no options, see SequoiaDB Information Center "SequoiaDB Shell Methods" for more detail. e.g.: {"Offline":true}
  • Offline : Use offline mode to create index or not, default to be false
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.CreateIndex ( string  name,
BsonDocument  key,
bool  isUnique,
bool  isEnforced 
)
inline

Create an index with name and key.

Parameters
nameThe index name.
keyThe index key.
isUniqueWhether the index elements are unique or not
isEnforcedWhether the index is enforced unique. This element is meaningful when isUnique is group to true.
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.CreateIndex ( string  name,
BsonDocument  key,
bool  isUnique,
bool  isEnforced,
int  sortBufferSize 
)
inline

Specify sort buffer size to create an index.

Parameters
nameThe index name.
keyThe index key.
isUniqueWhether the index elements are unique or not
isEnforcedWhether the index is enforced unique. This element is meaningful when isUnique is group to true.
sortBufferSizeThe size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer.
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.CreateIndex ( string  name,
BsonDocument  key,
BsonDocument  options 
)
inline

Create an index with options.

Parameters
nameThe index name.
keyThe index key.
optionsOptional configuration for creating index, like: { "Unique" : false , "Enforced" : false , "NotNull" : false , "SortBufferSize" : 64 }. Please reference HERE for more detail.
Exceptions
SequoiaDB.BaseException
System.Exception
DBLob SequoiaDB.DBCollection.CreateLob ( )
inline

Create a large object.

Returns
The newly created lob object
Exceptions
SequoiaDB.BaseException
System.Exception
DBLob SequoiaDB.DBCollection.CreateLob ( ObjectId  id)
inline

Create a large object with specified oid.

Parameters
idThe oid for the creating lob
Exceptions
SequoiaDB.BaseException
System.Exception
ObjectId SequoiaDB.DBCollection.CreateLobID ( DateTime  dt)
inline

Create a lobID from server by using the user-provided DateTime.

Parameters
dtLobID's relative time.
Returns
ObjectId object.
Exceptions
SequoiaDB.BaseException
System.Exception
ObjectId SequoiaDB.DBCollection.CreateLobID ( )
inline

Create a lobID from server by using the server's system time.

Returns
ObjectId object.
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.Delete ( BsonDocument  matcher)
inline

Delete the matching document of current collection.

Parameters
matcherThe matching condition, delete all the documents if null
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.Delete ( BsonDocument  matcher,
BsonDocument  hint 
)
inline

Delete the matching document of current collection.

Parameters
matcherThe matching condition, delete all the documents if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.DetachCollection ( string  subClFullName)
inline

Detach the specified collection.

Parameters
subClFullNameThe name of the subcollection
Return values
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.DisableCompression ( )
inline

Alter the attributes of current collection to enable compression

Exceptions
SequoiaDB.BaseException
System.Exception.

void SequoiaDB.DBCollection.DisableSharding ( )
inline

Alter the attributes of current collection to disable sharding

Exceptions
SequoiaDB.BaseException
System.Exception.

void SequoiaDB.DBCollection.DropAutoIncrement ( String  fieldName)
inline

Drop autoincrement field on collection.

Parameters
fieldNamethe field of autoincrement to be drop, can not be null or empty.
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.DropAutoIncrement ( List< string >  fieldNames)
inline

Drop autoincrement fields on collection.

Parameters
fieldNamesthe fields of autoincrement to be drop, can not be null or empty.
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.DropIdIndex ( )
inline

Drop $id index in collection.

Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.DropIndex ( string  name)
inline

Remove the named index of current collection.

Parameters
nameThe index name
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.EnableCompression ( BsonDocument  options)
inline

Alter the attributes of current collection to enable compression.

Parameters
optionsThe options for altering current collection:
CompressionType : The compression type of data, could be "snappy" or "lzw"
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.EnableSharding ( BsonDocument  options)
inline

Alter the attributes of current collection to enable sharding.

Parameters
optionsThe options for altering current collection:
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
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.Explain ( BsonDocument  query,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint,
long  skipRows,
long  returnRows,
int  flag,
BsonDocument  options 
)
inline

Find documents of current collection.

Parameters
queryThe matching rule, return all the documents if null
selectorThe selective rule, return the whole document if null
orderByThe ordered rule, never sort if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
skipRowsSkip the first numToSkip documents, never skip if this parameter is 0
returnRowsReturn the specified amount of documents, when returnRows is 0, return nothing, when returnRows is -1, return all the documents
flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag

DBQuery.FLG_QUERY_FORCE_HINT DBQuery.FLG_QUERY_PARALLED DBQuery.FLG_QUERY_WITH_RETURNDATA

Parameters
[in]optionsThe rules of query 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}
Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
long SequoiaDB.DBCollection.GetCount ( BsonDocument  matcher,
BsonDocument  hint 
)
inline

Get the count of matching documents in current collection.

Parameters
matcherThe matching rule, when condition is null, the return amount contains all the records.
hintSpecified 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 null, database automatically match the optimal index to scan data.
Returns
The count of matching documents
Exceptions
SequoiaDB.BaseException
System.Exception
long SequoiaDB.DBCollection.GetCount ( BsonDocument  matcher)
inline

Get the count of matching documents in current collection.

Parameters
matcherThe matching rule, when condition is null, the return amount contains all the records.
Returns
The count of matching documents
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.GetIndex ( string  name)
inline

Get the named index of current collection.

Parameters
nameThe index name
Returns
A index, if not exist then return null
Exceptions
SequoiaDB.BaseException
System.Exception
Deprecated:
Use "GetIndexes" and "GetIndexInfo" instead.
DBCursor SequoiaDB.DBCollection.GetIndexes ( )
inline

Get all the indexes of current collection.

Returns
A cursor of all indexes or null
Exceptions
SequoiaDB.BaseException
System.Exception
BsonDocument SequoiaDB.DBCollection.GetIndexInfo ( string  name)
inline

Get the information of index in current collection.

Parameters
nameThe index name.
Returns
The index information.
Exceptions
SequoiaDB.BaseException
System.Exception
BsonDocument SequoiaDB.DBCollection.GetIndexStat ( string  name)
inline

Get the statistics of the index.

Parameters
nameThe index name.
Returns
The index statistics information.
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.GetQueryMeta ( BsonDocument  query,
BsonDocument  orderBy,
BsonDocument  hint,
long  skipRows,
long  returnRows 
)
inline

Get the index blocks' or data blocks' infomations for concurrent query.

Parameters
querythe matching rule, return all the meta information if null
orderBythe ordered rule, never sort if null
hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means not using any index to scan data(table scan). when hint is null, database automatically match the optimal index to scan data.
skipRowsThe rows to be skipped
returnRowsreturn the specified amount of documents, when returnRows is 0, return nothing, when returnRows is -1, return all the documents
Returns
The DBCursor of matching infomations or null
Exceptions
SequoiaDB.BaseException
System.Exception
Deprecated:
this API only support in java
BsonDocument SequoiaDB.DBCollection.Insert ( List< BsonDocument recordList,
int  flags 
)
inline

Insert documents into current collection.

Parameters
recordThe Bson document of insertor, can't be null.
flagsThe flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
  • 0: while 0 is set(default to be 0), database will stop inserting when the record hit index key duplicate error.
  • SDBConst.FLG_INSERT_CONTONDUP: if the record hit index key duplicate error, database will skip them and go on inserting.
  • SDBConst.FLG_INSERT_RETURN_OID: return the value of "_id" field in the record.
  • SDBConst.FLG_INSERT_REPLACEONDUP: if the record hit index key duplicate error, database will replace the existing record by the inserting new record and them go on inserting.
Returns
The result of inserting, can be the follow value:
  • null: when there is no result to return.
  • bson which contains the "_id" field: when flag "FLG_INSERT_RETURN_OID" is set, return the value of "_id" field of the inserted record. e.g.: { "_id": { "$oid": "5c456e8eb17ab30cfbf1d5d1" } }
Exceptions
SequoiaDB.BaseException
System.Exception
BsonDocument SequoiaDB.DBCollection.Insert ( BsonDocument  record,
int  flags 
)
inline

Insert a document into current collection.

Parameters
recordThe Bson document of insertor, can't be null.
flagsThe flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
  • 0: while 0 is set(default to be 0), database will stop inserting when the record hit index key duplicate error.
  • SDBConst.FLG_INSERT_CONTONDUP: if the record hit index key duplicate error, database will skip them and go on inserting.
  • SDBConst.FLG_INSERT_RETURN_OID: return the value of "_id" field in the record. When set this flag, "EnsureOID" will be set to true.
  • SDBConst.FLG_INSERT_REPLACEONDUP: if the record hit index key duplicate error, database will replace the existing record by the inserting new record.
Returns
The result of inserting, can be the follow value:
  • null: when there is no result to return.
  • bson which contains the "_id" field: when flag "FLG_INSERT_RETURN_OID" is set, return all the values of "_id" field in a bson array. e.g.: { "_id": [ { "$oid": "5c456e8eb17ab30cfbf1d5d1" }, { "$oid": "5c456e8eb17ab30cfbf1d5d2" } ] }
Exceptions
SequoiaDB.BaseException
System.Exception
BsonValue SequoiaDB.DBCollection.Insert ( BsonDocument  record)
inline

Insert a document into current collection.

Parameters
recordThe Bson document of insertor, can't be null.
Returns
Return the value of field "_id" in "insertor". If "insertor" has no field "_id", API will add one and return the value which type is ObjectId, so we can get the return value by BsonValue::AsObjectId property.
Exceptions
SequoiaDB.BaseException
System.Exception
bool SequoiaDB.DBCollection.IsIndexExist ( string  name)
inline

Test the specified index exist or not.

Parameters
nameThe index name.
Returns
True for exist while false for not.
DBCursor SequoiaDB.DBCollection.ListLobs ( )
inline

List all of the lobs in current collection.

Return values
DBCursorof lobs
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.ListLobs ( BsonDocument  matcher,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint,
long  skipRows,
long  returnRows 
)
inline

List the lobs.

Parameters
matcherthe matching rule, return all the lobs if null.
selectorthe selective rule, return the whole lobs if null.
orderBythe ordered rule, never sort if null.
hintSpecified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs.
skipRowsskip the first skipRows lobs, never skip if this parameter is 0.
returnRowsreturn the specified amount of lobs, when returnRows is 0, return nothing, when returnRows is -1, return all the lobs.
Return values
DBCursorof lobs.
Exceptions
SequoiaDB.BaseException
System.Exception
Since
v3.2.4
DBLob SequoiaDB.DBCollection.OpenLob ( ObjectId  id,
int  mode 
)
inline

Open an existing lob with the speceifed oid.

Parameters
idThe oid of the existing lob
modeOpen mode: DBLob.SDB_LOB_READ for reading, DBLob.SDB_LOB_WRITE for writing. DBLob.SDB_LOB_SHAREREAD for share read. DBLob.SDB_LOB_SHAREREAD | DBLob.SDB_LOB_WRITE for both reading and writing
Exceptions
SequoiaDB.BaseException
System.Exception
DBLob SequoiaDB.DBCollection.OpenLob ( ObjectId  id)
inline

Open an existing lob with the speceifed oid.

Parameters
idThe oid of the existing lob
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.Query ( )
inline

Find all documents of current collection.

Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.Query ( DBQuery  query)
inline

Find documents of current collection with DBQuery.

Parameters
queryDBQuery with matching condition, selector, order rule, hint, SkipRowsCount and ReturnRowsCount
Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.Query ( BsonDocument  query,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint 
)
inline

Find documents of current collection.

Parameters
queryThe matching rule, return all the documents if null
selectorThe selective rule, return the whole document if null
orderByThe ordered rule, never sort if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.Query ( BsonDocument  query,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint,
long  skipRows,
long  returnRows 
)
inline

Find documents of current collection.

Parameters
queryThe matching rule, return all the documents if null
selectorThe selective rule, return the whole document if null
orderByThe ordered rule, never sort if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
skipRowsSkip the first numToSkip documents, never skip if this parameter is 0
returnRowsReturn the specified amount of documents, when returnRows is 0, return nothing, when returnRows is -1, return all the documents
Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.Query ( BsonDocument  query,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint,
long  skipRows,
long  returnRows,
int  flag 
)
inline

Find documents of current collection.

Parameters
queryThe matching rule, return all the documents if null
selectorThe selective rule, return the whole document if null
orderByThe ordered rule, never sort if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
skipRowsSkip the first numToSkip documents, never skip if this parameter is 0
returnRowsReturn the specified amount of documents, when returnRows is 0, return nothing, when returnRows is -1, return all the documents
flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag

DBQuery.FLG_QUERY_FORCE_HINT DBQuery.FLG_QUERY_PARALLED DBQuery.FLG_QUERY_WITH_RETURNDATA DBQuery.FLG_QUERY_FOR_UPDATE

Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.QueryAndRemove ( BsonDocument  query,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint,
long  skipRows,
long  returnRows,
int  flag 
)
inline

Find documents of current collection and remove.

Parameters
queryThe matching rule, return all the documents if null
selectorThe selective rule, return the whole document if null
orderByThe ordered rule, never sort if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
skipRowsSkip the first numToSkip documents, never skip if this parameter is 0
returnRowsReturn the specified amount of documents, when returnRows is 0, return nothing, when returnRows is -1, return all the documents
flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag

DBQuery.FLG_QUERY_FORCE_HINT DBQuery.FLG_QUERY_PARALLED DBQuery.FLG_QUERY_WITH_RETURNDATA DBQuery.FLG_QUERY_FOR_UPDATE

Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBCursor SequoiaDB.DBCollection.QueryAndUpdate ( BsonDocument  query,
BsonDocument  selector,
BsonDocument  orderBy,
BsonDocument  hint,
BsonDocument  update,
long  skipRows,
long  returnRows,
int  flag,
bool  returnNew 
)
inline

Find documents of current collection and update.

Parameters
queryThe matching rule, return all the documents if null
selectorThe selective rule, return the whole document if null
orderByThe ordered rule, never sort if null
hintSpecified 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 null, database automatically match the optimal index to scan data.
skipRowsSkip the first numToSkip documents, never skip if this parameter is 0
returnRowsReturn the specified amount of documents, when returnRows is 0, return nothing, when returnRows is -1, return all the documents
updateThe update rule, can't be null
flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag

DBQuery.FLG_QUERY_FORCE_HINT DBQuery.FLG_QUERY_PARALLED DBQuery.FLG_QUERY_WITH_RETURNDATA DBQuery.FLG_QUERY_KEEP_SHARDINGKEY_IN_UPDATE DBQuery.FLG_QUERY_FOR_UPDATE

Parameters
returnNewWhen true, returns the updated document rather than the original
Returns
The DBCursor of matching documents or null
Exceptions
SequoiaDB.BaseException
System.Exception
DBLob SequoiaDB.DBCollection.RemoveLob ( ObjectId  id)
inline

Remove an existing lob with the speceifed oid.

Parameters
idThe oid of the existing lob
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.SetAttributes ( BsonDocument  options)
inline

Alter the attributes of current collection to set attributes.

Parameters
optionsThe options for altering current collection:
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}]}
Note
Can't alter attributes about split in partition collection; After altering a collection to be a partition collection, need to split this collection manually
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.Split ( string  sourceGroupName,
string  destGroupName,
BsonDocument  splitCondition,
BsonDocument  splitEndCondition 
)
inline

Split the collection from one group into another group by range.

Parameters
sourceGroupNameThe source group
destGroupNameThe destination group
splitConditionThe split condition
splitEndConditionThe 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 targe group will get the records whose age's hash value are in [30,60). If splitEndCondition is null, they are in [30,max).
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.Split ( string  sourceGroupName,
string  destGroupName,
double  percent 
)
inline

Split the collection from one group into another group by percent.

Parameters
sourceGroupNameThe source group
destGroupNameThe destination group
percentpercent The split percent, Range:(0.0, 100.0]
Exceptions
SequoiaDB.BaseException
System.Exception
long SequoiaDB.DBCollection.SplitAsync ( String  sourceGroupName,
String  destGroupName,
BsonDocument  splitCondition,
BsonDocument  splitEndCondition 
)
inline

Split the specified collection from source group to target group by range asynchronously.

Parameters
sourceGroupNamethe source group name
destGroupNamethe destination group name
splitConditionthe split condition
splitEndConditionthe 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 targe group will get the records whose age's hash values are in [30,60). If splitEndCondition is null, they are in [30,max).
Returns
return the task id, we can use the return id to manage the sharding which is run backgroup.
Exceptions
SequoiaDB.BaseException
System.Exception
See Also
listTask, cancelTask
long SequoiaDB.DBCollection.SplitAsync ( String  sourceGroupName,
String  destGroupName,
double  percent 
)
inline

Split the specified collection from source group to target group by percent asynchronously.

Parameters
sourceGroupNamethe source group name
destGroupNamethe destination group name
percentthe split percent, Range:(0,100]
Returns
return the task id, we can use the return id to manage the sharding which is run backgroup.
Exceptions
SequoiaDB.BaseException
System.Exception
See Also
listTask, cancelTask
void SequoiaDB.DBCollection.Truncate ( )
inline

Truncate the collection.

Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
DBLob SequoiaDB.DBCollection.TruncateLob ( ObjectId  id,
long  length 
)
inline

Truncate an exist lob.

Parameters
idThe oid of the existing lob.
lengthThe truncate length.
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.DBCollection.Update ( DBQuery  query)
inline

Update the document of current collection.

Parameters
queryDBQuery with matching condition, updating rule and hint
Exceptions
SequoiaDB.BaseException
System.Exception
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect
void SequoiaDB.DBCollection.Update ( BsonDocument  matcher,
BsonDocument  modifier,
BsonDocument  hint 
)
inline

Update the document of current collection.

Parameters
matcherThe matching condition, update all the documents if null
modifierThe updating rule, can't be null
hintSpecified 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 null, database automatically match the optimal index to scan data.
Exceptions
SequoiaDB.BaseException
System.Exception
Note
It won't work to update the "ShardingKey" field, but the other fields take effect
void SequoiaDB.DBCollection.Update ( BsonDocument  matcher,
BsonDocument  modifier,
BsonDocument  hint,
int  flag 
)
inline

Update the document of current collection.

Parameters
matcherThe matching condition, update all the documents if null
modifierThe updating rule, can't be null
hintSpecified 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 null, database automatically match the optimal index to scan data.
flagThe update flag, default to be 0. Please see the definition of follow flags for more detail.

SDBConst.FLG_UPDATE_KEEP_SHARDINGKEY

Exceptions
SequoiaDB.BaseException
System.Exception
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect
void SequoiaDB.DBCollection.Upsert ( BsonDocument  matcher,
BsonDocument  modifier,
BsonDocument  hint 
)
inline

Update the document of current collection, insert if no matching.

Parameters
matcherThe matching condition, update all the documents if null(that's to say, we match all the documents)
modifierThe updating rule, can't be null
hintSpecified 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 null, database automatically match the optimal index to scan data.
Exceptions
SequoiaDB.BaseException
System.Exception
Note
It won't work to upsert the "ShardingKey" field, but the other fields take effect
void SequoiaDB.DBCollection.Upsert ( BsonDocument  matcher,
BsonDocument  modifier,
BsonDocument  hint,
BsonDocument  setOnInsert 
)
inline

Update the document of current collection, insert if no matching.

Parameters
matcherThe matching condition, update all the documents if null(that's to say, we match all the documents)
modifierThe updating rule, can't be null
hintSpecified 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 null, database automatically match the optimal index to scan data.
setOnInsertThe setOnInsert assigns the specified values to the fileds when insert
Exceptions
SequoiaDB.BaseException
System.Exception
Note
It won't work to upsert the "ShardingKey" field, but the other fields take effect
void SequoiaDB.DBCollection.Upsert ( BsonDocument  matcher,
BsonDocument  modifier,
BsonDocument  hint,
BsonDocument  setOnInsert,
int  flag 
)
inline

Update the document of current collection, insert if no matching.

Parameters
matcherThe matching condition, update all the documents if null(that's to say, we match all the documents)
modifierThe updating rule, can't be null
hintSpecified 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 null, database automatically match the optimal index to scan data.
setOnInsertThe setOnInsert assigns the specified values to the fileds when insert
flagThe upsert flag, default to be 0. Please see the definition of follow flags for more detail.

SDBConst.FLG_UPDATE_KEEP_SHARDINGKEY

Exceptions
SequoiaDB.BaseException
System.Exception
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect

Property Documentation

SequoiaDB.DBCollection.CollSpace
get

\ brief Return the Collection Space handle of current collection

Returns
CollectionSpace object
SequoiaDB.DBCollection.EnsureOID
getset

Get or set whether insert oid in records when bulk insert.

Returns
True for ensure, false for not
SequoiaDB.DBCollection.FullName
get

Return the full name of current collection.

Returns
The collection name
SequoiaDB.DBCollection.Name
get

Return the name of current collection.

Returns
The collection name

The documentation for this class was generated from the following file: