SequoiaDB
 All Classes Files Functions
Public Member Functions | List of all members
SequoiaCL Class Reference

Public Member Functions

array string insert (array|string $record)
 Inserts an array into the collection.
 
array string update (array|string $rule, array|string $condition=NULL, array|string $hint=NULL)
 Update the matching documents in current collection.
 
array string remove (array|string $condition=NULL, array|string $hint=NULL)
 Remove records from this collection.
 
SequoiaCursor find (array|string $condition=NULL, array|string $select=NULL, array|string $orderBy=NULL, array|string $hint=NULL, int $numToSkip=0, int $numToReturn=-1)
 Querys this collection, returning a SequoiaCursor for the result set.
 
SequoiaCursor findAndUpdate (array|string $update, array|string $condition=NULL, array|string $select=NULL, array|string $orderBy=NULL, array|string $hint=NULL, int $numToSkip=0, int $numToReturn=-1, bool $returnNew=FALSE)
 Querys this collection, returning a SequoiaCursor for the result set and update.
 
SequoiaCursor findAndRemove (array|string $condition=NULL, array|string $select=NULL, array|string $orderBy=NULL, array|string $hint=NULL, int $numToSkip=0, int $numToReturn=-1)
 Querys this collection, returning a SequoiaCursor for the result set and remove.
 
array string split (string $sourceName, string $destName, array|string $condition, array|string $endCondition=NULL)
 data split,source collection split to dest collection
 
array string split (string $sourceName, string $destName, double $percent)
 data split,source collection split to dest collection
 
array string drop (void)
 Drops this collection.
 
SequoiaCursor aggregate (array|string $aggrObj)
 aggregate this collection, returning a SequoiaCursor for the result set
 
array string createIndex (array|string $indexDef, string $pIndexName, bool $isUnique=false, bool $isEnforced=false, int $sortBufferSize=64)
 Create the index in current collection.
 
array string deleteIndex (string $pIndexName)
 delete the index in current collection
 
SequoiaCursor getIndex (string $pIndexName="")
 Get all of or one of the indexes in current collection.
 
string getCSName (void)
 Returns this collection space's name.
 
string getCollectionName (void)
 Returns this collection's name.
 
string getFullName (void)
 Returns this collection full name.
 
int count (array|string $condition=NULL)
 Counts the number of documents in this collection.
 
int truncate (void)
 Removes all rows from a collection without logging the individual row deletions.
 
int createIdIndex (void)
 create records "_id" index.
 
int dropIdIndex (void)
 drop records "_id" index.
 

Member Function Documentation

SequoiaCursor SequoiaCL::aggregate ( array|string  $aggrObj)

aggregate this collection, returning a SequoiaCursor for the result set

Parameters
[in]$aggrObjAggregation parameter, if the input string or an associative array, you can enter only one parameter, such as the string, "{ $project: {field:1}}", an associative array, array( '$project' => array ( 'field' => 1 ) ), if the input array, you can enter multiple parameters, such as array ( "{$project:{field1:1,field2:2}}", "{$project:{field1:1}}" ) or array ( array ( '$project' => array ( 'field1' => 1, "field2' => 2 ) ), array ( '$project' => array ( 'field1' => 1 ) ) )
Return values
Returnsa SequoiaCursor for the result set
int SequoiaCL::count ( array|string  $condition = NULL)

Counts the number of documents in this collection.

Parameters
[in]$conditionThe matching rule, return the count of all documents if this parameter is null
Return values
Returnsthe number of documents matching the query
int SequoiaCL::createIdIndex ( void  )

create records "_id" index.

Return values
Returnsthe database response
array string SequoiaCL::createIndex ( array|string  $indexDef,
string  $pIndexName,
bool  $isUnique = false,
bool  $isEnforced = false,
int  $sortBufferSize = 64 
)

Create the index in current collection.

Parameters
[in]$indexDefThe bson structure of index element, e.g. {name:1, age:-1}
[in]$pIndexNameThe index name
[in]$isUniqueWhether the index elements are unique or not,default is FALSE
[in]$isEnforcedWhether the index is enforced unique This element is meaningful when isUnique is set to true
[in]$sortBufferSizeThe size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer
Return values
Returnsthe database response
array string SequoiaCL::deleteIndex ( string  $pIndexName)

delete the index in current collection

Parameters
[in]$pIndexNameThe index name
Return values
Returnsthe database response
array string SequoiaCL::drop ( void  )

Drops this collection.

Return values
Returnsthe database response
int SequoiaCL::dropIdIndex ( void  )

drop records "_id" index.

Return values
Returnsthe database response
SequoiaCursor SequoiaCL::find ( array|string  $condition = NULL,
array|string  $select = NULL,
array|string  $orderBy = NULL,
array|string  $hint = NULL,
int  $numToSkip = 0,
int  $numToReturn = -1 
)

Querys this collection, returning a SequoiaCursor for the result set.

Parameters
[in]$conditionThe matching rule, return all the documents if null
[in]$selectThe selective rule, return the whole document if null
[in]$orderByThe ordered rule, never sort if null
[in]$hintThe hint, automatically match the optimal hint if null
[in]$numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]$numToReturnOnly return numToReturn documents, return all if this parameter is -1
Return values
Returnsa SequoiaCursor for the result set
SequoiaCursor SequoiaCL::findAndRemove ( array|string  $condition = NULL,
array|string  $select = NULL,
array|string  $orderBy = NULL,
array|string  $hint = NULL,
int  $numToSkip = 0,
int  $numToReturn = -1 
)

Querys this collection, returning a SequoiaCursor for the result set and remove.

Parameters
[in]$conditionThe matching rule, return all the documents if null
[in]$selectThe selective rule, return the whole document if null
[in]$orderByThe ordered rule, never sort if null
[in]$hintThe hint, automatically match the optimal hint if null
[in]$numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]$numToReturnOnly return numToReturn documents, return all if this parameter is -1
Return values
Returnsa SequoiaCursor for the result set
SequoiaCursor SequoiaCL::findAndUpdate ( array|string  $update,
array|string  $condition = NULL,
array|string  $select = NULL,
array|string  $orderBy = NULL,
array|string  $hint = NULL,
int  $numToSkip = 0,
int  $numToReturn = -1,
bool  $returnNew = FALSE 
)

Querys this collection, returning a SequoiaCursor for the result set and update.

Parameters
[in]$updateThe update rule, can't be null
[in]$conditionThe matching rule, return all the documents if null
[in]$selectThe selective rule, return the whole document if null
[in]$orderByThe ordered rule, never sort if null
[in]$hintThe hint, automatically match the optimal hint if null
[in]$numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]$numToReturnOnly return numToReturn documents, return all if this parameter is -1
[in]$returnNewWhen TRUE, returns the updated document rather than the original
Return values
Returnsa SequoiaCursor for the result set
string SequoiaCL::getCollectionName ( void  )

Returns this collection's name.

Return values
Returnsthe name of this collection
string SequoiaCL::getCSName ( void  )

Returns this collection space's name.

Return values
Returnsthe name of this collection space
string SequoiaCL::getFullName ( void  )

Returns this collection full name.

Return values
Returnsthe name of this collection space
SequoiaCursor SequoiaCL::getIndex ( string  $pIndexName = "")

Get all of or one of the indexes in current collection.

Parameters
[in]$pIndexNameThe index name
Return values
Returnsa new SequoiaCursor object
array string SequoiaCL::insert ( array|string  $record)

Inserts an array into the collection.

Parameters
[in]$recorda record
Return values
Returnsan array or string of the object id
array string SequoiaCL::remove ( array|string  $condition = NULL,
array|string  $hint = NULL 
)

Remove records from this collection.

Parameters
[in]$conditioncondition The matching rule, delete all the documents if null
[in]$hintThe hint, automatically match the optimal hint if null
Return values
Returnsthe database response
array string SequoiaCL::split ( string  $sourceName,
string  $destName,
array|string  $condition,
array|string  $endCondition = NULL 
)

data split,source collection split to dest collection

Parameters
[in]$sourceNamesource collection
[in]$destNamedest collection
[in]$conditionThe matching rule
[in]$endConditionThe end of matching rule
Return values
Returnsthe database response
array string SequoiaCL::split ( string  $sourceName,
string  $destName,
double  $percent 
)

data split,source collection split to dest collection

Parameters
[in]$sourceNamesource collection
[in]$destNamedest collection
[in]$percentpercentage of split
Return values
Returnsthe database response
int SequoiaCL::truncate ( void  )

Removes all rows from a collection without logging the individual row deletions.

Return values
Returnsthe database response
array string SequoiaCL::update ( array|string  $rule,
array|string  $condition = NULL,
array|string  $hint = NULL 
)

Update the matching documents in current collection.

Parameters
[in]$ruleThe updating rule, cannot be null
[in]$conditionThe matching rule, update all the documents if this parameter is null
[in]$hintThe hint, automatically match the optimal hint if null
Note
It won't work to update the "ShardingKey" field, but the other fields take effect
Return values
Returnsthe database response

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